These are positional arguments of the script.
Executing
./script.sh Hello World
Will make
$0 = ./script.sh
$1 = Hello
$2 = World
Note
If you execute ./script.sh
, $0
will give output ./script.sh
but if you execute it with bash script.sh
it will give output script.sh
.
More Related Contents:
- What does 2>&1 mean here?
- Input data to a shell script [closed]
- How to reload .bashrc settings without logging out and back in again?
- How do I iterate over a range of numbers defined by variables in Bash?
- When do we need curly braces around shell variables?
- Bash command line and input limit
- Replace one substring for another string in shell script
- How to assign the output of a Bash command to a variable? [duplicate]
- Running script upon login in mac OS X [closed]
- How to append output to the end of a text file
- Command substitution: backticks or dollar sign / paren enclosed? [duplicate]
- Using the RUN instruction in a Dockerfile with ‘source’ does not work
- Is there a TRY CATCH command in Bash
- Piping tail output though grep twice
- bash set -e and i=0;let i++ do not agree
- Why is “[[ 10 < 2 ]]" true when comparing numbers in bash? [duplicate]
- How to go to each directory and execute a command?
- Relative paths based on file location instead of current working directory [duplicate]
- Counting lines or enumerating line numbers so I can loop over them – why is this an anti-pattern?
- pipe stdout and stderr to two different processes in shell script?
- Why equal to operator does not work if it is not surrounded by space?
- In bash, is there an equivalent of die “error msg”
- How can I convert tabs to spaces in every file of a directory?
- How do I integrate MSYS2 shell into Visual studio code on Window?
- How do I get both STDOUT and STDERR to go to the terminal and a log file?
- -bash: __git_ps1: command not found
- Use GNU find to show only the leaf directories
- Get the name of the caller script in bash script
- docker entrypoint running bash script gets “permission denied”
- What does `kill -0 $pid` in a shell script do?