I have the following script to check if a NFS mount is currently mounted on the server :
#!/bin/bash
$targetserver=192.168.3.1
commandline="mount | grep '$targetserver' | wc -l"
checkmount=`$commandline`
if [ $checkmount == "1" ]; then
echo "Mounted !"
else
echo "Not mounted"
fi
But it seems that my checkmount is not returning anything.
What am I missing here ?
mount | grep ...bit on the command line?checkmountvariable to make sure it's got the value you expect (i.e. 0 or 1). That's generally a good way to debug scripts.