readonly builtin

The builtin that makes a variable unchangeable for the rest of the shell's life, used for constants.

In more detail

Any later attempt to assign it is an error, which catches accidental reuse of a name. The course style puts readonly constants near the top of a script, in capitals.

Example

readonly SOURCE_FILE="poem.txt"

Related terms

Taught in

References