On Dec 6, 2007, at 10:00 AM, Steven Buehler wrote:
I hope this is the right list to ask this on. I am creating a shell script for something and the following line (whether run from the script or the command line) gives me an error: if [ ! -z /bin/cat /tmp/BACKUP/tmp | /bin/grep 'not accepted' ] ; then echo hi; else echo no; fi
On Dec 6, 2007, at 10:12 AM, <m.roth2006@xxxxxxx> wrote:
However, a simpler, cleaner version would be: if [ `grep -c "not accepted" /tmp/BACKUP/tmp` -gt 0 ]; then echo yep else echo nope fi
Or simpler yet, and much faster with large input: if fgrep -q 'not accepted' /tmp/BACKUP/tmp; then echo yes else echo no fi -- Ian Ward Comfort <icomfort@xxxxxxxxxxxxxxxxxxxx> System Administrator, Student Computing, Stanford University -- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list