Skip to content

Instantly share code, notes, and snippets.

@thatisuday
Last active July 9, 2022 23:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thatisuday/10b6c065fd9c98d7fff74127fb356364 to your computer and use it in GitHub Desktop.
Save thatisuday/10b6c065fd9c98d7fff74127fb356364 to your computer and use it in GitHub Desktop.
Special Characters in Bash
Special Character Description Extra information
$_ Absolute path of the shell binary file that is executing the script Ex. /bin/bash or /bin.sh
$0 Path of the executing Bash script Ex. ./my-file.sh
$N Nth argument passed to the executing Bash script $1 is 'apple' for the command 'bash file.sh apple'
$* All arguments passed to the executing Bash script expands to a word inside double-quotes
$@ All arguments passed to the executing Bash script expands to a separate words inside double-quotes
$# Number of arguments passed to the executing Bash script $# is 3 for the command 'bash file.sh A B C'
$? Exit status code of last executed command in the foreground returns a decimal number between 0-255
$! Process ID of last executed command in the background empty of no background command was extecuted
$$ Process ID of executing Bash script returns a decimal number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment