bash script help?
Nils Kassube
kassube at gmx.net
Mon Nov 14 06:15:22 UTC 2011
Knute Johnson wrote:
> I've got a bash script that I run in cron.daily to backup some data
> to a jump drive. One of the commands in my script is to umount the
> drive. If I write;
>
> if umount /dev/sdb1; then
> #do something
> fi
>
> it always does it even if the umount is successful.
You mean: "if it fails"? Well, I can't confirm. Try this as root:
if umount / 2>/dev/null; then echo 1;else echo 0;fi
Here the output is "0", which I would expect. If I replace / with an
unmountable partition, the output is "1".
Nils
More information about the ubuntu-users
mailing list