Last active
July 9, 2022 23:11
-
-
Save thatisuday/10b6c065fd9c98d7fff74127fb356364 to your computer and use it in GitHub Desktop.
Special Characters in Bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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