Mark a variable or function as read-only.

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

   -a   Restrict the variables to arrays

   -p   Display output in a format that can 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 can 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 macOS commands:

set - Set a shell variable = value

Copyright © 1999-2018
Some rights reserved