Quoting Gideon Guillen <[EMAIL PROTECTED]>:
> In MS-DOS batchfiles, there's this thing called error codes or error
> levels
> that's generated whenever a program or batchfiles exits/terminates. For
> example, for normal termination, it would be '0' or let's say '1' if a
> certain event was trapped by a batchfile. In MS-DOS, this is the
> environment %ERRORLEVEL%. What is it's equivalent on *NIX/Linux shells,
> preferably in bash.
The exit status of the most recently executed program
is accessible through the special parameter $? To see how $?
may be used in shell scripts, do the following:
man bash
and search for all occurrences of the word "exit status".
You'll be surprised how useful "exit status" is and how many
shell script constructs test for exit status. You'll also
see how much more powerful Unix/Linux scripting is compared
to DOS/command.com.
And while you're reading the bash manual, you might also
want to check out the following special parameters and
how they are used:
${variable}, $0, $1, S2, ..., $@, $#
[EMAIL PROTECTED]
--------
This mail sent through IMP: mail.ateneo.net
_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]