The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 11-29-2004
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
  
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100

Code:
echo "string" | grep 'x' >/dev/null 2>&1
if [ "$?" -eq "0" ]; then
  echo "Found x in string"
else
  echo "Couldnt find it"
fi

You get the idea....

Check out my hangman shell script - you can see the technique employed.

I wish I had a job like your co-worker!

Cheers
ZB