Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
Violent or Repulsive Content
Hateful or Abusive Content
Harmful Dangerous Acts
Infringes My Rights
A variable in a shell script is a means of referencing a numeric or character value. And unlike formal programming languages, a shell script doesn't require you to declare a type for your variables.
There are some variables which are set internally by the shell and which are available to the user:
$1 - $9 these variables are the positional parameters.
$0 the name of the command currently being executed.
$# the number of positional arguments given to this
invocation of the shell.
$? the exit status of the last command executed is
given as a decimal string. When a command
completes successfully, it returns the exit status
of 0 (zero), otherwise it returns a non-zero exit
$$ the process number of this shell - useful for
including in filenames, to make them unique.
$! the process id of the last command run in
$- the current options supplied to this invocation
of the shell.
$* a string containing all the arguments to the
shell, starting at $1.