On 27 February 2013 23:40, gnulinuxist@gmail.com gnulinuxist@gmail.com wrote:
-----Original Message----- From: Rajeev R. K.
Here you go.....
mount | grep -q home HOMESTATUS=$? mount | grep -q backup BACKUPSTATUS=$?
if [ $HOMESTATUS -eq 0 -a $BACKUPSTATUS -eq 0 ]; then echo "You got both man, do your thing..." exit 0; else echo "Error -- either home or backup missing -- Or is it BOTH !%$!!@#%!" exit 1; fi
Regards R. K. Rajeev
Thanks Rajeev and Binand for your tips. I noticed a '-a' option in the if statement so will this below work?
If [grep -q "/home" mtab -a grep -q "/backup" mtab ] then.........
Doubtful, since the square brackets are little more than a shorthand for encapsulating the conditional and comparative expression syntax of the test command(check man test), and in this case, test would not know how to evaluate the expressions. In any case, my earlier point about having independent tests still stands from a usability standpoint.
Regards R. K. Rajeev
Regards, Rony.