The readonly command sets the value and/or readonly attribute of variables. It is equivalent to the typeset –r command, except that when used within a function, a local variable is not created. This command sets X to readonly and assigns it a value of 1:
$ readonly X=1
This is equivalent to:
$ typeset —r X=1
Multiple variables can be given to the readonly command.
$ readonly X Y=1 Z=2
If no arguments are given, a list of readonly variables and their values is displayed:
$ readonly Z=1 Y=1 Z=2 PPID=175