readonly

Mark a variable or function as read-only.

Syntax
      readonly [-apf] [name[=word] ...]

Key
   -a   Restrict the variables to arrays

   -p   Display output in a format that may be reused as input

   -f   Mark functions corresponding to the names as read-only

The given names are marked readonly; the values of these names may not be changed by subsequent assignment.

If no name arguments are given,or if the -p option is supplied, a list of all readonly names is printed.

If a variable name is followed by =word, the value of the variable is set to word.

The return status is 0 unless an invalid option is encountered, one of the names is not a valid shell variable name, or -f is supplied with a name that is not a function.
readonly is a bash builtin command.

“The universe is like a safe to which there is a combination. But the combination is locked up in the safe” ~ Peter De Vries

Related:

set - Set a shell variable = value


© Copyright SS64.com 1999-2014
Some rights reserved