The readonly built-in makes variables and functions read-only.

Syntax

  • readonly [-pxX] [name[=value]…]

  • readonly -f[p] [name…]

Description

The readonly built-in is equivalent to the typeset built-in with the -gr option.

Notes

The readonly built-in is a special built-in.

The POSIX standard defines the -p option only; other options cannot be used in the POSIXly-correct mode. The POSIX does not allow using the option together with operands.