Re: Getting the return value of the last command run

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



On Mon, May 30, 2011 at 10:38 AM, Dotan Cohen <dotancohen@xxxxxxxxx> wrote:
> All commands return a value, usually 0 if run properly. For instance, try:
> $ ls && echo "done"
> $ lsd && echo "done"
>
> The echo command is only executed if the ls command exited
> successfully. If one did not add the echo command with the && after a
> command, how can he determine if the command exited successfully?

You can check the return code.

$ ls
$ echo $?

0 (usually) indicates success.

- Bob
_______________________________________________
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