I am trying to compare a substring in bash (How to check if a string contains a substring in Bash). Normally I can do this like so:
if [[ "sdfdsfOpenSSHdsfsdf" == *"OpenSSH"* ]]; then echo "substring found"; fi
However, when using an interactive command it doesn't work:
if [[ $(ssh -V) == *"OpenSSH"* ]]; then echo "substring found"; fi
The output of ssh -V is OpenSSH_8.4p1, OpenSSL 1.1.1h  22 Sep 2020, so I would expect the substring to be matched. What am I missing?
 
    