Bash - Parameter

> Procedural Languages > Bash Shell and (Unix|Linux) Utilities (XCU)

1 - About

A variable in bash is called a parameter.

There is three different type of parameter

A parameter can be then referenced by:

  • a name,
  • a number
  • or a special symbol (Special Character)

A parameter is set if it has been assigned a value. (The null string is a valid value)

Advertising

3 - Management

3.1 - Check if set

if [ -z ${var+x} ]; then echo "var is unset"; else echo "var is set to '$var'"; fi

where