[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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 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.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]