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

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

asp.net mvc - Implementing normal user/pass, Twitter & Facebook auth -