BASH – Default variables for a bash shell

Print Friendly, PDF & Email

$?    =>  Return code of previous command
$0    =>  Name of the script itself
$1-9  =>  Argument number 1 to 9 given to script
${10} => Argument number 10 given to script
$#    => Total number of arguments given to script
$@    => All arguments given to script but as an individual string values
"$*"  => All arguments given to script as a single string value (must be in double quotes)
$$    => Process id of the script
$!    => Process id of last job run in backgroup
$_    => Last argument given to previous command

sanaswati
Comments are closed.