When doing scripting in shell, like bash, there are a few built-in variables that we can use to optimize our script. Below are a few useful ones:
- $$ = The PID number of the process executing the shell.
- $? = Exit status variable.
- $0 = The name of the command you used to call a program.
- $1 = The first argument on the command line.
- $2 = The second argument on the command line.
- $n = The nth argument on the command line. n = 0-9
- $* = All the arguments on the command line.
- $# = The number of command line arguments.
Hope this can help
No comments:
Post a Comment