[linux-lvm] Simple scripts for use in automated backups?

Stuart D. Gathman stuart at bmsi.com
Wed Apr 23 19:18:49 UTC 2008


On Wed, 23 Apr 2008, Tomasz Chmielewski wrote:

> *Usually*, a command exits with code 0 if it finishes with a success.
> 
> In bash, you can check the exit code with $? variable.
> 
> So:
> 
> 
> lvmcommand --option1 --option2
> 
> if [ $? -eq 0 ] ; then
>     do_this
> else
>     do_that
> fi

Even easier, the shell considers exit code 0 as "true", so the above is simply:

if lvmcommand --option1 --option2; then
    do_this
else
    do_that
fi

-- 
	      Stuart D. Gathman <stuart at bmsi.com>
    Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.




More information about the linux-lvm mailing list