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

Re: Bash commands



On 2002-09-01 14:25:53, Russell wrote:
> 
>   debpc:# if [ -n df /mnt | grep -ie "/dev/hdc1" ] ; then echo "yes" ; fi

You need the put 'df ..' in back quotes (``) to get it executed,
but usually the exist status ($?) of grep is used to do this:

df /mnt | grep -ie /dev/hdc1 > /dev/null; if [ $? -nq 0 ]; then echo "yes"; fi

or shorter:

mount | grep -qs /dev/hdc1 && echo yes


/Allan
-- 
Allan Wind
P.O. Box 2022
Woburn, MA 01888-0022
USA

Attachment: pgp7bYOav9vTE.pgp
Description: PGP signature


Reply to: