[wplug] shell script madness

Mike Griffin mike at dmrnetworks.com
Wed Jul 16 09:28:44 EDT 2003


What is it that you're trying to do?
I think you're trying to see if files exist on that mount, correct?

how about:

if [ `mount | grep PITT-NW02 | wc -l` != 0 ]
then
   echo "Files exist on this mount"
fi

Even for a drive that isn't in existence you're going to get a '0' for 
the output of wc -l used in this fashion without an error.
If you just want to see if the mount exists, try something like this:

/bin/mount | grep PITT-NW02

if [ $? -ne 0 ]
then
   echo "mount does not exist"
fi


Mike


On Wednesday, July 16, 2003, at 09:11  AM, Alexandros Papadopoulos 
wrote:

> Please help me here, I'm entering the twilight zone:
>
> [alex at dhcp13-33 alex]$ mount
> /dev/hda1 on / type ext3 (rw)
> none on /proc type proc (rw)
> usbdevfs on /proc/bus/usb type usbdevfs (rw)
> none on /dev/pts type devpts (rw,gid=5,mode=620)
> /dev/hda5 on /home type ext3 (rw)
> none on /dev/shm type tmpfs (rw)
> none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
> PITT-NW01/PAPADOPA.USERS.PITT.PENN.SEAGATE on 
> /home/alex/SEAGATE/PITT-NW01
> type ncpfs (rw)
> [alex at dhcp13-33 alex]$ if [ `mount | grep PITT-NW01 | wc -l` ]; then 
> echo
> lala; fi
> lala
> [alex at dhcp13-33 alex]$ if [ `mount | grep PITT-NW02 | wc -l` ]; then 
> echo
> lala; fi
> lala
> [alex at dhcp13-33 alex]$ mount | grep PITT-NW02 | wc -l
>       0
> [alex at dhcp13-33 alex]$
>
> What's happening here??
>
> -A
>
>
> _______________________________________________
> wplug mailing list
> wplug at wplug.org
> http://www.wplug.org/mailman/listinfo/wplug
>




More information about the wplug mailing list