Name
readonly
Synopsis
readonly [options] [variable1 variable2 ...]
Description
Prevent the specified shell variables from being assigned new values. Variables can be accessed (read) but not overwritten. In bash, the syntax variable = value can be used to assign a new value that cannot be changed.
Options
- -a
Treat the following names as array variables.
- -f
Treat the following names as functions, and set them read-only so that they cannot be changed.
- -p
Display all read-only variables (default).
Get Linux in a Nutshell, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.