On , I learnt ...

About readonly Bash variables

Doing this:

readonly myvar=1

means that $myvar can’t have its value changed within the global scope.

$ myvar=2
-bash: myvar: readonly variable

You can use declare -r to enforce immutability within a local scope (e.g. within a function body).

See the Linux Shell Scripting Tutorial wiki for basic examples. See this Stack Overflow answer for more details on the differences between readonly and declare -r.