Re: Getting the return value of the last command run

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



On Mon, 30 May 2011, Christopher J. Buckley wrote:

> To: CentOS mailing list <centos@xxxxxxxxxx>
> From: Christopher J. Buckley <chris@xxxxxxxxxxxxx>
> Subject: Re:  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]
-----------------------------------------------------------------
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux