using return values in shell scripts
From: Jim Showalter (highpriest_at_earthlink.net)
Date: 09/30/04
- Next message: Bit Twister: "Re: using return values in shell scripts"
- Previous message: Average Joe: "screen restore after curses program"
- Next in thread: Bit Twister: "Re: using return values in shell scripts"
- Reply: Bit Twister: "Re: using return values in shell scripts"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Sep 2004 00:05:31 GMT
How can I conditionally use the return code of a command ('mount' in this
case) in a shell script?
I want to do something like:
#!/bin/sh
# first, mount the SMB volume
val=`mount -t smbfs -o username=jill,password="" //HAL/C /mnt/hal`
if [ $val -eq 0 ] ; then
echo "$val"
ls /mnt/hal
smbumount /mnt/hal
else
echo "$val"
echo "Cannot mount //HAL/C on /mnt/hal"
echo "$val"
exit 1
fi
exit 0
-- _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ _/ Everything should be made as simple as possible, but not simpler. _/ -- Albert Einstein _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
- Next message: Bit Twister: "Re: using return values in shell scripts"
- Previous message: Average Joe: "screen restore after curses program"
- Next in thread: Bit Twister: "Re: using return values in shell scripts"
- Reply: Bit Twister: "Re: using return values in shell scripts"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|