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. Read-only variables may not be unset.

Options

-a

Each variable must refer to an array.

-f

Each variable must refer to a function.

-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 bash Quick Reference 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.