Russell wrote: > > Allan Wind wrote: > > > > 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 > > This works good. I've been looking for a way just to print the > exit status ( $? ) which i know now:) > > debpc:# mount | grep -qs /dev/hdc1 ; echo $?
This works to: if mount | grep -qs /dev/hdc1; then echo $?; fi I might have gotten somewhere initially if i hadn't have used those square [] brackets. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]