MPE/iX Shell and Utilities Reference Manual, Vol 2
readonly(1) MPE/iX Shell and Utilities readonly(1)
NAME
readonly — mark variable as readonly
SYNOPSIS
readonly [–p][name[=value] ...]
DESCRIPTION
readonly prevents subsequent changes in the value of any of the name arguments. Parame-
ters of the form
name=value
assign value to name as well as marking name readonly. Calling readonly without argu-
ments lists, with appropriate quoting, the names which you have set as readonly in the follow-
ing format:
Variable="value"
This format is suitable for reading by a shell script, but to ensure readonly access, use the –p
option.
Options
readonly accepts the following option:
–p displays export name=value pairs which when read by a shell ensures the readonly
status and values of variables.
Note: Unless you go to a new shell, or unset the variables, sourcing the output fails
with errors, since you can’t attempt to change readonly variables.
DIAGNOSTICS
Possible exit status values:
0 Successful completion.
2 Failure due to invalid command line argument.
Messages
Because this utility is built into the
MPE/iX Shell, see the sh(1) man page for a complete list of
error messages that you may receive when using it.
PORTABILITY
POSIX.2. x/OPEN Portability Guide 4.0. readonly is a built-in command of the Bourne Shell
and KornShell on UNIX systems.
The behavior given for calling readonly with no arguments is an extension to the POSIX
standard.
Commands and Utilities 1-481