Acredito que você esteja procurando readonly
.
readonly FOO='bar'
Eles não podem ser alterados e também não podem ser desfeitos. Do manual de Bash :
readonly [-aAf] [-p] [name[=value]] …
Mark each name as readonly. The values of these names may not be changed by subsequent assignment. If the
-f
option is supplied, each name refers to a shell function. The-a
option means each name refers to an indexed array variable; the-A
option means each name refers to an associative array variable. If both options are supplied,-A
takes precedence.If no name arguments are given, or if the
-p
option is supplied, a list of all readonly names is printed. The other options may be used to restrict the output to a subset of the set of readonly names.The
-p
option causes output to be displayed in a format that may be reused as input. If a variable name is followed by=value
, the value of the variable is set tovalue
. The return status is zero unless an invalid option is supplied, one of the name arguments is not a valid shell variable or function name, or the-f
option is supplied with a name that is not a shell function.