📄 alias.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>alias</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_000_020"> </a>NAME</h4><blockquote>alias - define or display aliases</blockquote><h4><a name = "tag_000_000_021"> </a>SYNOPSIS</h4><blockquote><pre><code>alias <b>[</b><i>alias-name</i><b>[</b>=<i>string</i><b>]</b> ...<b>]</b></code></pre></blockquote><h4><a name = "tag_000_000_022"> </a>DESCRIPTION</h4><blockquote>The<i>alias</i>utility creates or redefines alias definitions or writesthe values of existing alias definitions to standard output.An alias definition provides a string valuethat replaces a command name when it is encountered.See<xref href=alsub><a href="chap2.html#tag_001_003_001">Alias Substitution</a></xref>.<p>An alias definition affects the current shell execution environmentand the execution environments of the subshells of the current shell.When used as specified by this specification, the alias definitionwill not affect the parent process of the current shellnor any utility environment invoked by the shell.See<xref href=shexenv><a href="chap2.html#tag_001_012">Shell Execution Environment</a></xref>.</blockquote><h4><a name = "tag_000_000_023"> </a>OPTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_000_024"> </a>OPERANDS</h4><blockquote>The following operands are supported:<dl compact><dt><i>alias-name</i><dd>Write the alias definition to standard output.<dt><i>alias-name</i><b>=</b><i>string</i><dd>Assign the value of<i>string</i>to the alias<i>alias-name</i>.</dl><p>If no operands are given, all alias definitionswill be written to standard output.</blockquote><h4><a name = "tag_000_000_025"> </a>STDIN</h4><blockquote>Not used.</blockquote><h4><a name = "tag_000_000_026"> </a>INPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_000_027"> </a>ENVIRONMENT VARIABLES</h4><blockquote>The following environment variables affect the execution of<i>alias</i>:<dl compact><dt><i>LANG</i><dd>Provide a default value for the internationalisation variablesthat are unset or null.If<i>LANG</i>is unset or null, the corresponding value from theimplementation-dependent default locale will be used.If any of the internationalisation variables contains an invalid setting, theutility will behave as if none of the variables had been defined.<dt><i>LC_ALL</i><dd>If set to a non-empty string value,override the values of all the other internationalisation variables.<dt><i>LC_CTYPE</i><dd>Determine thelocale for the interpretation of sequences of bytes of text data ascharacters (for example, single- as opposed to multi-byte charactersin arguments).<dt><i>LC_MESSAGES</i><dd>Determine the locale that should be used to affectthe format and contents of diagnosticmessages written to standard error.<dt><i>NLSPATH</i><dd>Determine the location of message cataloguesfor the processing of<i>LC_MESSAGES .</i></dl></blockquote><h4><a name = "tag_000_000_028"> </a>ASYNCHRONOUS EVENTS</h4><blockquote>Default.</blockquote><h4><a name = "tag_000_000_029"> </a>STDOUT</h4><blockquote>The format for displaying aliases (when no operands or only<i>name</i>operands are specified) is:<code><p><tt>"%s=%s\n"</tt>, <i>name</i>,<i>value</i></code><p>The<i>value</i>string will be written with appropriate quoting so that it issuitable for reinput to the shell.See the description of shell quoting in<xref href=quoting><a href="chap2.html#tag_001_002">Quoting</a></xref>.</blockquote><h4><a name = "tag_000_000_030"> </a>STDERR</h4><blockquote>Used only for diagnostic messages.</blockquote><h4><a name = "tag_000_000_031"> </a>OUTPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_000_032"> </a>EXTENDED DESCRIPTION</h4><blockquote>None.</blockquote><h4><a name = "tag_000_000_033"> </a>EXIT STATUS</h4><blockquote>The following exit values are returned:<dl compact><dt>0<dd>Successful completion.<dt>>0<dd>One of the<i>name</i>operands specified did not have an alias definition, oran error occurred.</dl></blockquote><h4><a name = "tag_000_000_034"> </a>CONSEQUENCES OF ERRORS</h4><blockquote>Default.</blockquote><h4><a name = "tag_000_000_035"> </a>APPLICATION USAGE</h4><blockquote>None.</blockquote><h4><a name = "tag_000_000_036"> </a>EXAMPLES</h4><blockquote><ol><p><li>Change<i><a href="ls.html">ls</a></i>to give a columnated, more annotated output:<pre><code>alias ls="ls -CF"</code></pre><p><li>Create a simple "redo" command to repeat previous entries in thecommand history file:<pre><code>alias r='fc -s'</code></pre><p><li>Use 1K units for<i><a href="du.html">du</a></i>:<pre><code>alias du=du\ -k</code></pre><p><li>Set up<i><a href="nohup.html">nohup</a></i>so that it can deal with an argument that is itself an alias name:<pre><code>alias nohup="nohup "</code></pre><p></ol></blockquote><h4><a name = "tag_000_000_037"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_000_038"> </a>SEE ALSO</h4><blockquote><xref href=funccmd><a href="chap2.html#tag_001_009_005">Function Definition Command</a></xref>.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -