[wplug] shell script madness

Alexandros Papadopoulos apapadop at andrew.cmu.edu
Wed Jul 16 10:15:16 EDT 2003


On Wed, 16 Jul 2003, Mike Griffin wrote:

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

Just trying to know if something is mounted or not.

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

This works indeed, but isn't this test statement supposed to be the same
with the ones I was using?

What's the difference of:
if [ `mount | grep lala | wc -l` ]
and
if [ `mount | grep lala | wc -l` != 0 ]

?

I thought that if the test statement returns non-zero, the statement
executes, therefore rendering comparisons with zero in tests
completely redundant...

Thanks for the help

-A



More information about the wplug mailing list