If you want to grep for multiple strings in the same file, and exit if any of them is found, it is more efficient (and I think more maintainable) to specify them in one line:
grep -q -e test2 -e test3 file2 && exit 0 The "-q" is --quiet - just to suppress the output if you aren't interested in it (in this case you are only interested in the exit status, not the output). The -e flag introduces each search term. If the list of strings to look for is longer or variable then you can feed it to grep from a file using -f. See "man grep" for all the details. On 19 March 2014 18:22, <li...@sbt.net.au> wrote: > > > grep "test2" file2 && exit 0 > > Peter, > > thanks, I'll try that > > so, I could use multiple conditions like so: > > grep "test2" file2 && exit 0 > grep "test3" file2 && exit 0 > > ? thanks > > > -- > SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ > Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html > -- [image: View my profile on LinkedIn] <http://www.linkedin.com/in/gliderflyer> -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html