args

All posts tagged args

$# : Number of arguments passed via script

$0 : Name of the script

$@ : Names of arguments passed to the script at execution

$$ : Process ID associated with script

$OSTYPE : What’s the OS type?

$TERM :  What’s term is being used?

$USER : What’s the username that executed the script?

$HOSTNAME : What’s the hostname of the box that ran the script?

$LOGNAME :  What was the login username?

$LINENO : Current line # of the script

$RANDOM : Random #

$BASH_SOURCE :  What’s the bash source?

Example script: