views:

24

answers:

1

I am trying to write a bash script to automatically mount a volume that is in /dev (EC2 EBS storage). When the device is connected, it shows up as /dev/sdf (always)...but the "find" command does not work on it when it is there (just not technically mounted in /etc/mtab).

These do not work:

[ -f /dev/sdf ] && echo "It exists" || echo "It does not exist"

[ -d /dev/sdf ] && echo "It exists" || echo "It does not exist"

What am I missing?

+2  A: 

You want -b. See help test.

Ignacio Vazquez-Abrams
It's the little things in Bash that never fail to amaze me. Thanks.