View Single Post

   
  #7 (permalink)  
Old 01-05-2008, 09:09 AM
=?iso-8859-1?Q?St=E9phane?= GASSIES
 
Posts: n/a
Default Re: check if a filesystem is mounted

Hi Tim,
this should to the trick.

.... as you get in MOUNT_POINT the mount point value (if mounted)
or you get the upper-level filesystem (no matters what it is).

Also, you cannot use your variable MONT_POINT if the computed
value is not the one expected...

Retagds,
Stephane

#!/bin/ksh
#
# test fs mount status
#
MOUNT_POINT=$(df /comx/data 2>/dev/null | awk ' (NR==2) {print $NF}')
if [[ $MOUNT_POINT != /comx/data ]] then
echo "fs is not mounted: /comx/data"
else
echo "fs is mounted: $MOUNT_POINT"
fi
Reply With Quote