Re: Simple scripts for use in automated backups?

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

 



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.

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

[Index of Archives]     [Gluster Users]     [Kernel Development]     [Linux Clusters]     [Device Mapper]     [Security]     [Bugtraq]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]

  Powered by Linux