The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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-24-2007
lamilami lamilami is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 9
use if []; then .....else......
use the exit status of grep as condition
grep exits with 0 if the string is found, 1 if not found and 2 if the file is not there.
then use > to redirect your output to a file and >> to append your output to the file.

have fun!