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

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

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -