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

NAME

12       readonly - set the readonly attribute for variables
13

SYNOPSIS

15       readonly name[=word]...
16
17       readonly -p
18
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 IEEE Std 1003.1-2001, 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
34              "readonly %s=%s\n", <name>, <value>
35
36       if name is set, and
37
38
39              "readonly %s\n", <name>
40
41       if name is unset.
42
43       The shell shall format the output, including the proper use of quoting,
44       so  that  it  is  suitable  for  reinput  to the shell as commands that
45       achieve the same value and  readonly  attribute-setting  results  in  a
46       shell execution environment in which:
47
48        1. Variables  with values at the time they were output do not have the
49           readonly attribute set.
50
51        2. Variables that were unset at the time they were output do not  have
52           a  value  at  the  time at which the saved output is reinput to the
53           shell.
54
55       When no arguments are given, the results are unspecified.
56

OPTIONS

58       See the DESCRIPTION.
59

OPERANDS

61       See the DESCRIPTION.
62

STDIN

64       Not used.
65

INPUT FILES

67       None.
68

ENVIRONMENT VARIABLES

70       None.
71

ASYNCHRONOUS EVENTS

73       Default.
74

STDOUT

76       See the DESCRIPTION.
77

STDERR

79       The standard error shall be used only for diagnostic messages.
80

OUTPUT FILES

82       None.
83

EXTENDED DESCRIPTION

85       None.
86

EXIT STATUS

88       Zero.
89

CONSEQUENCES OF ERRORS

91       Default.
92
93       The following sections are informative.
94

APPLICATION USAGE

96       None.
97

EXAMPLES

99              readonly HOME PWD
100

RATIONALE

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

FUTURE DIRECTIONS

120       None.
121

SEE ALSO

123       Special Built-In Utilities
124
126       Portions  of  this text are reprinted and reproduced in electronic form
127       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
128       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
129       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
130       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
131       event of any discrepancy between this version and the original IEEE and
132       The  Open Group Standard, the original IEEE and The Open Group Standard
133       is the referee document. The original Standard can be  obtained  online
134       at http://www.opengroup.org/unix/online.html .
135
136
137
138IEEE/The Open Group                  2003                         READONLY(1P)
Impressum