Skip to content
This repository has been archived by the owner on Aug 24, 2023. It is now read-only.

Special bash characters

Rayan edited this page Jun 13, 2023 · 1 revision
Special bash character Meaning
# # is used to comment a single line in bash script
$$ $$ is used to reference process id of any command or bash script
$0 $0 is used to get the name of the command in a bash script.
$name $name will print the value of variable “name” defined in the script.
$n $n will print the value of nth argument provided to bash script (n ranges from 0 to 9) e.g. $1 will print first argument.
> > is used to redirect output
>> >> can be used to Append to file
< < will redirect input
[ ] [] are for matching any characters enclosed
( ) Execute in subshell
Another powerful special bash character which is used to substitute output of enclosed command
" " Partial quote (allows variable and command expansion)
' ' Full quote (no expansion)
\ Quote following character
| Pipe output of one command to another most useful and immensely power bash character
& & is used to run any process in the background.
; ;(semi colon ) is used to separate commands on same line
* * is used to match any character(s) in filename
? ? is for matching single character in filename
Clone this wiki locally