Skip to content

Instantly share code, notes, and snippets.

@itsamenathan
Created May 27, 2014 00:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsamenathan/124cd684d2fd58d82063 to your computer and use it in GitHub Desktop.
Save itsamenathan/124cd684d2fd58d82063 to your computer and use it in GitHub Desktop.
if with grep -q
word=Linux
letter_sequence=inu
if echo "$word" | grep -q "$letter_sequence"
# The "-q" option to grep suppresses output.
then
echo "$letter_sequence found in $word"
else
echo "$letter_sequence not found in $word"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment