1

Help with grep and if

view story
linux-howto

http://www.unix.com – Hi, I'm working on a script which includes a part where i need to search for a string first using "grep" and then compare it with another variable using "if". It should be something like a=search pattern using grep if [ $a = $b ] then .. The problem i'm facing is, in case the grep returns no result i get a syntax error in the if section. Grep can have either 1 or 0 results only. Any help to get through this? (HowTos)