bash question

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

 



Hi!

  Try variable $?.

  You can test exit codes with following scriptlette

#!/bin/bash
$*
echo Exit=$?


  In scripts you can also use if-statements: if program return zero on
exit it is true, otherwise false.

  There are also following shortcuts

cmd1 && cmd2

  Cmd2 is run only when cmd1 return zero.

cdm1 || cmd2

  Cmd2 is run only when cmd2 returns non-zero.

-- 
arimo

On Wed, 4 Aug 2004, Gregory Nowak wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi all.
>
> If I'm running a program by invoking it from a bash prompt, can
> someone please tell me how I can check it's return value? I looked at
> the bash man page, but couldn't find anything on this. Thanks.
>
> Greg
>
>
> - --
> Free domains: http://www.eu.org/ or mail dns-manager at EU.org
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.3 (GNU/Linux)
>
> iD8DBQFBEbn27s9z/XlyUyARArHZAJwOsM88C5FJSm8hQTPZW5nXFvuTrgCgihIB
> sAEDzTj+QAJp4PVyD3dgoqw=
> =nVkf
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Speakup mailing list
> Speakup at braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
>




[Index of Archives]     [Linux for the Blind]     [Fedora Discussioin]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]
  Powered by Linux