On Mon, 30 May 2011, Christopher J. Buckley wrote:
To: CentOS mailing list centos@centos.org From: Christopher J. Buckley chris@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.htmlQuick 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:
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] -----------------------------------------------------------------