User Tools

Site Tools


bash:built-in_variables

BASH - Built-in variables

When doing scripting in the shell there are a few built-in variables that we can used:

$$ = The PID number of the process executing the shell.
$? = Exit status variable.  Nearly all Linux programs return a 0 error status for true and anything else is false.
$0 = The name of the command you used to call a program.
$1 = The first argument on the command line.
$2 = The second argument on the command line.
$n = The nth argument on the command line. n = 0-9
$* = All the arguments on the command line.
$# = The number of command line arguments.
bash/built-in_variables.txt · Last modified: 2021/01/26 11:42 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki