⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readonly.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2003 The Open Group, All Rights Reserved --><title>readonly</title></head><body bgcolor="white"><basefont size="3"> <a name="readonly"></a> <a name="tag_04_118"></a><!-- readonly --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright &copy; 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_04_118_01"></a>NAME</h4><blockquote>readonly - set the readonly attribute for variables</blockquote><h4><a name="tag_04_118_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><p><code><tt>readonly name</tt><b>[</b><tt>=</tt><i>word</i><b>]</b><tt>...<br><br> readonly -p<br></tt></code></p></blockquote><h4><a name="tag_04_118_03"></a>DESCRIPTION</h4><blockquote><p>The variables whose <i>name</i>s are specified shall be given the <i>readonly</i> attribute. The values of variables with the<i>readonly</i> attribute cannot be changed by subsequent assignment, nor can those variables be unset by the <a href="../utilities/unset.html"><i>unset</i></a> utility. If the name of a variable is followed by = <i>word</i>, then the value of thatvariable shall be set to <i>word</i>.</p><p>The <i>readonly</i> special built-in shall support the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/xbd_chap12.html#tag_12_02">Section 12.2, Utility Syntax Guidelines</a>.</p><p>When <b>-p</b> is specified, <i>readonly</i> writes to the standard output the names and values of all read-only variables, inthe following format:</p><pre><tt>"readonly %s=%s\n", &lt;</tt><i>name</i><tt>&gt;, &lt;</tt><i>value</i><tt>&gt;</tt></pre><p>if <i>name</i> is set, and</p><pre><tt>"readonly %s\n", &lt;</tt><i>name</i><tt>&gt;</tt></pre><p>if <i>name</i> is unset.</p><p>The shell shall format the output, including the proper use of quoting, so that it is suitable for reinput to the shell ascommands that achieve the same value and <i>readonly</i> attribute-setting results in a shell execution environment in which:</p><ol><li><p>Variables with values at the time they were output do not have the <i>readonly</i> attribute set.</p></li><li><p>Variables that were unset at the time they were output do not have a value at the time at which the saved output is reinput tothe shell.</p></li></ol><p>When no arguments are given, the results are unspecified.</p></blockquote><h4><a name="tag_04_118_04"></a>OPTIONS</h4><blockquote><p>See the DESCRIPTION.</p></blockquote><h4><a name="tag_04_118_05"></a>OPERANDS</h4><blockquote><p>See the DESCRIPTION.</p></blockquote><h4><a name="tag_04_118_06"></a>STDIN</h4><blockquote><p>Not used.</p></blockquote><h4><a name="tag_04_118_07"></a>INPUT FILES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_118_08"></a>ENVIRONMENT VARIABLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_118_09"></a>ASYNCHRONOUS EVENTS</h4><blockquote><p>Default.</p></blockquote><h4><a name="tag_04_118_10"></a>STDOUT</h4><blockquote><p>See the DESCRIPTION.</p></blockquote><h4><a name="tag_04_118_11"></a>STDERR</h4><blockquote><p>The standard error shall be used only for diagnostic messages.</p></blockquote><h4><a name="tag_04_118_12"></a>OUTPUT FILES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_118_13"></a>EXTENDED DESCRIPTION</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_118_14"></a>EXIT STATUS</h4><blockquote><p>Zero.</p></blockquote><h4><a name="tag_04_118_15"></a>CONSEQUENCES OF ERRORS</h4><blockquote><p>Default.</p></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_04_118_16"></a>APPLICATION USAGE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_118_17"></a>EXAMPLES</h4><blockquote><pre><tt>readonly HOME PWD</tt></pre></blockquote><h4><a name="tag_04_118_18"></a>RATIONALE</h4><blockquote><p>Some historical shells preserve the <i>readonly</i> attribute across separate invocations. This volume ofIEEE&nbsp;Std&nbsp;1003.1-2001 allows this behavior, but does not require it.</p><p>The <b>-p</b> option allows portable access to the values that can be saved and then later restored using, for example, a <ahref="../utilities/dot.html"><i>dot</i></a> script. Also see the RATIONALE for <a href="export.html#tag_04_49"><i>export</i></a>for a description of the no-argument and <b>-p</b> output cases and a related example.</p><p>Read-only functions were considered, but they were omitted as not being historical practice or particularly useful. Furthermore,functions must not be read-only across invocations to preclude ``spoofing'' (spoofing is the term for the practice of creating aprogram that acts like a well-known utility with the intent of subverting the real intent of the user) of administrative orsecurity-relevant (or security-conscious) shell scripts.</p></blockquote><h4><a name="tag_04_118_19"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_118_20"></a>SEE ALSO</h4><blockquote><p><a href="xcu_chap02.html#tag_02_14"><i>Special Built-In Utilities</i></a></p></blockquote><h4><a name="tag_04_118_21"></a>CHANGE HISTORY</h4><h4><a name="tag_04_118_22"></a>Issue 6</h4><blockquote><p>IEEE PASC Interpretation 1003.2 #203 is applied, clarifying the format when a variable is unset.</p><p>IEEE&nbsp;Std 1003.1-2001/Cor&nbsp;1-2002, item XCU/TC1/D6/5 is applied so that the reference page sections use terms asdescribed in the Utility Description Defaults ( <a href="xcu_chap01.html#tag_01_11"><i>Utility Description Defaults</i></a> ). Nochange in behavior is intended.</p><p>IEEE&nbsp;Std 1003.1-2001/Cor&nbsp;1-2002, item XCU/TC1/D6/7 is applied, adding the following text to the end of the firstparagraph of the DESCRIPTION: ``If the name of a variable is followed by = <i>word</i>, then the value of that variable shall beset to <i>word</i>.''. The reason for this change is that the SYNOPSIS for <i>readonly</i> includes:</p><pre><tt>readonly name</tt><b>[</b><tt>=</tt><i>word</i><b>]</b><tt>...</tt></pre><p>but the meaning of the optional ``= <i>word</i>'' is never explained in the text.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX &reg; is a registered Trademark of The Open Group.<br>POSIX &reg; is a registered Trademark of The IEEE.<br>[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>]</font></center><!--footer end--><hr size="2" noshade></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -