Home / Bash programming basics edit
Try Documentalist, my app that offers fast, offline access to 190+ programmer API docs.

Script arguments
Script arguments are passed as $0 (name of the script), $1 (first argument) etc.
$* - all arguments, as single word.$@ - all arguments, but each is seen as a separate word
Check if a given argument was provided
if [ ! -n "$1" ]
then
  echo "First argument not given"
fi
Handling errors from launched programs.
Exit code from last executed command is in $?.
if [ "$?" -ne "0" ]; then
  echo "last command failed"
  exit 1
fi

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:

Need fast, offline access to 190+ programmer API docs? Try my app Documentalist for Windows