[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: shell script error



Steven,

>Date: Thu, 6 Dec 2007 12:00:08 -0600
>From: "Steven Buehler" <steve ibushost com>  
>
>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
>
Yup - it's all inside test brackets, and that's expecting a single argument. You'd have to put it inside backticks. However, a simpler, cleaner version would be:
if [ `grep -c "not accepted" /tmp/BACKUP/tmp` -gt 0 ]; then
   echo yep
else
   echo nope
fi

  mark



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]