On 19 March 2014 22:23, Amos Shapira <amos.shap...@gmail.com> wrote: > 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
I like this and it probably does what the OP wanted, however it does do a different thing to the original program. The above line will exit the program if test2 is false and test3 is true. The original program required test2 to be true to exit. Yeah, pedantic :-) -- Norman Gaywood, Computer Systems Officer University of New England, Armidale, NSW 2351, Australia ngayw...@une.edu.au Phone: +61 (0)2 6773 2412 http://mcs.une.edu.au/~norm Fax: +61 (0)2 6773 3312 Please avoid sending me Word or Power Point attachments. See http://www.gnu.org/philosophy/no-word-attachments.html -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html