1READONLY(1P)               POSIX Programmer's Manual              READONLY(1P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10
11

NAME

13       readonly — set the readonly attribute for variables
14

SYNOPSIS

16       readonly name[=word]...
17
18       readonly −p
19

DESCRIPTION

21       The variables whose names are specified shall  be  given  the  readonly
22       attribute.  The  values of variables with the readonly attribute cannot
23       be changed by subsequent assignment, nor can those variables  be  unset
24       by  the  unset utility. If the name of a variable is followed by =word,
25       then the value of that variable shall be set to word.
26
27       The readonly special built-in shall support the Base Definitions volume
28       of POSIX.1‐2008, Section 12.2, Utility Syntax Guidelines.
29
30       When  −p is specified, readonly writes to the standard output the names
31       and values of all read-only variables, in the following format:
32
33           "readonly %s=%s\n", <name>, <value>
34
35       if name is set, and
36
37           "readonly %s\n", <name>
38
39       if name is unset.
40
41       The shell shall format the output, including the proper use of quoting,
42       so  that  it  is  suitable  for  reinput  to the shell as commands that
43       achieve the same value and  readonly  attribute-setting  results  in  a
44       shell execution environment in which:
45
46        1. Variables  with values at the time they were output do not have the
47           readonly attribute set.
48
49        2. Variables that were unset at the time they were output do not  have
50           a  value  at  the  time at which the saved output is reinput to the
51           shell.
52
53       When no arguments are given, the results are unspecified.
54

OPTIONS

56       See the DESCRIPTION.
57

OPERANDS

59       See the DESCRIPTION.
60

STDIN

62       Not used.
63

INPUT FILES

65       None.
66

ENVIRONMENT VARIABLES

68       None.
69

ASYNCHRONOUS EVENTS

71       Default.
72

STDOUT

74       See the DESCRIPTION.
75

STDERR

77       The standard error shall be used only for diagnostic messages.
78

OUTPUT FILES

80       None.
81

EXTENDED DESCRIPTION

83       None.
84

EXIT STATUS

86       Zero.
87

CONSEQUENCES OF ERRORS

89       Default.
90
91       The following sections are informative.
92

APPLICATION USAGE

94       None.
95

EXAMPLES

97       readonly HOME PWD
98

RATIONALE

100       Some historical shells preserve the readonly attribute across  separate
101       invocations. This volume of POSIX.1‐2008 allows this behavior, but does
102       not require it.
103
104       The −p option allows portable access to the values that  can  be  saved
105       and  then later restored using, for example, a dot script. Also see the
106       RATIONALE for export for a description of the no-argument and −p output
107       cases and a related example.
108
109       Read-only functions were considered, but they were omitted as not being
110       historical practice or particularly useful. Furthermore, functions must
111       not  be read-only across invocations to preclude ``spoofing'' (spoofing
112       is the term for the practice of creating a program  that  acts  like  a
113       well-known utility with the intent of subverting the real intent of the
114       user) of administrative or  security-relevant  (or  security-conscious)
115       shell scripts.
116

FUTURE DIRECTIONS

118       None.
119

SEE ALSO

121       Section 2.14, Special Built-In Utilities
122
123       The Base Definitions volume of POSIX.1‐2008, Section 12.2, Utility Syn‐
124       tax Guidelines
125
127       Portions of this text are reprinted and reproduced in  electronic  form
128       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
129       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
130       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
131       cal and Electronics Engineers,  Inc  and  The  Open  Group.   (This  is
132       POSIX.1-2008  with  the  2013  Technical Corrigendum 1 applied.) In the
133       event of any discrepancy between this version and the original IEEE and
134       The  Open Group Standard, the original IEEE and The Open Group Standard
135       is the referee document. The original Standard can be  obtained  online
136       at http://www.unix.org/online.html .
137
138       Any  typographical  or  formatting  errors that appear in this page are
139       most likely to have been introduced during the conversion of the source
140       files  to  man page format. To report such errors, see https://www.ker
141       nel.org/doc/man-pages/reporting_bugs.html .
142
143
144
145IEEE/The Open Group                  2013                         READONLY(1P)
Impressum