Special $ (dollar) shell variables
If you use Linux or another UNIX-like operating system and find yourself forgetting exactly which $ prefixed command does what, this is for you:
-
$$- the PID of the current process -
$!- the PID of the most recent background process -
$?- the most recent exit code -
$#- the number of passed parameters -
$*/$@- a string / array of the passed parameters -
$_- the most recent parameter -
$0- script/program name (0th parameter) -
$1...$9- positional parameters 1 through 9 -
$NAME- references environment variable "NAME"
Written by Benjamin Harris
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#