linux - Script on bash, can you? -
there string $string, in syllables written spaces. if variable $word have @ least 1 syllable in string, report of in way.
your solution checks see if $word exists in $string when should other way around. try this:
string="run walk stand" word=walking if echo "$string" | sed -e 's/ /\n/g' | grep -fqif - <(echo "$word") echo "match!" fi as can see, can test result of grep without having save output in variable.
by way -n same ! -z.
Comments
Post a Comment