What does $0 do in Linux? $0 expands to the name of the shell or shell script. This is set at shell initialization. If bash is invoked with a file of commands, $0 is set to the name of that file.
What is $0 in a script? If the $0 special variable is used within a Bash script, it can be used to print its name and if it is used directly within the terminal, it can be used to display the name of the current shell.
What is $0 $1 in shell script? $0 is the name of the script itself (script.sh) $1 is the first argument (filename1) $2 is the second argument (dir1) $9 is the ninth argument.
What does $$ do in Linux? $$ is the pid (process id) of the shell interpreter running your script. It’s different for each process running on a system at the moment, but over time the pid wraps around, and after you exit there will be another process with same pid eventually.As long as you’re running, the pid is unique to you.