Мне кажется, для этой цели есть string
функция:
$ set STRING something here
$ string match -q "other_string" $STRING; and echo yes
$ set STRING some other_string here
$ string match -q "other_string" $STRING; and echo yes
yes
или:
if string match -q "other_string" $STRING
echo it matches
else
echo is does not match
end