Name

readonly

Synopsis

    readonly [-afp] [variable[=value] ...]

Prevent the specified shell variables from being assigned new values. An initial value may be supplied using the assignment syntax, but that value may not be changed subsequently.

Options

ksh88 does not accept options for this command.

-a

Each variable must refer to an array. Bash only.

-f

Each variable must refer to an function. Bash only.

-p

Print readonly before printing the names and values of read-only variables. This allows saving a list of read-only variables for rereading later.

Get Unix in a Nutshell, 4th 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.