On Mon, 30 May 2011, Christopher J. Buckley wrote: > To: CentOS mailing list <centos at centos.org> > From: Christopher J. Buckley <chris at cjbuckley.net> > Subject: Re: [CentOS] Getting the return value of the last command run > > Have a read up on using return codes in Bash. > > http://tldp.org/LDP/abs/html/exit-status.html > > <http://tldp.org/LDP/abs/html/exit-status.html>Quick example: > > #!/bin/bash > > ls foobar > > if [ $? -eq 0 ] ; then > echo "successful" > else > echo "not successful" > fi > > You get the idea.. > > Cheers, > Chris Excellent Bash tutorial and reference with loads of working examples. I whole-heartedly recommend it and there are different versions such as PDF format under: http://tldp.org/LDP/abs/ Kind Regards, Keith Roberts ----------------------------------------------------------------- Websites: http://www.karsites.net http://www.php-debuggers.net http://www.raised-from-the-dead.org.uk All email addresses are challenge-response protected with TMDA [http://tmda.net] -----------------------------------------------------------------