On 11/01/2010 04:21 PM, Jesse Becker wrote: > On Mon, Nov 01, 2010 at 03:10:27PM -0400, Daniel V. Klein wrote: >> Try using grep -q, it is much easier than redirecting > > But not portable. The -q option is a GNU extension.
I don't know if maybe GNU had it first, but ‘-q’ is specified by POSIX (according to the GNU Grep documentation). > [je...@titan:~]$ uname -a > SunOS kronos 5.10 Generic_142900-08 sun4u sparc SUNW,Sun-Fire-V240 > > [je...@titan:~]$ grep -q foo tmpfile > grep: illegal option -- q > Usage: grep -hblcnsviw pattern file . . . Solaris 8 supports it, you just have to use the right grep. Not sure if the xpg4 commands exist on Solaris 10 since xpg4 has been superceded, but I would expect similar functionality. whar...@cds3 ~ $ uname -a SunOS cds3 5.8 Generic_117350-26 sun4u sparc SUNW,Ultra-60 whar...@cds3 ~ $ /usr/xpg4/bin/grep -q root /etc/passwd whar...@cds3 ~ $ echo $? 0 -- /* Wes Hardin */ UNIX System Administrator, IT Engineering Support Maxim Integrated Products: Innovation Delivered _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine