Thursday 21 May 2015

Bash script variables

Below is the list standard variables can be used in bash script.

  • $$ = Expands to the process ID of the shell
  • $0 = Name of bash script file.
  • $# = Number of arguments passed to bash script 
  • $1 = Argument 1
  • $2 = Argument 2
  • $@ = expands to the positional parameters, starting from one. i.e. "$@" is equivalent to "$1" "$2" …
  • $? = Exit status of mostly recently run process


No comments:

Post a Comment