📄 alias-command.html
字号:
<!-- Copyright (C) 2003 Red Hat, Inc. --><!-- This material may be distributed only subject to the terms --><!-- and conditions set forth in the Open Publication License, v1.0 --><!-- or later (the latest version is presently available at --><!-- http://www.opencontent.org/openpub/). --><!-- Distribution of the work or derivative of the work in any --><!-- standard (paper) book form is prohibited unless prior --><!-- permission is obtained from the copyright holder. --><HTML><HEAD><TITLE>alias</TITLE><meta name="MSSmartTagsPreventParsing" content="TRUE"><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="eCos Reference Manual"HREF="ecos-ref.html"><LINKREL="UP"TITLE="Common Commands"HREF="common-commands.html"><LINKREL="PREVIOUS"TITLE="Common Commands"HREF="common-commands.html"><LINKREL="NEXT"TITLE="baudrate"HREF="baudrate-command.html"></HEAD><BODYCLASS="REFENTRY"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">eCos Reference Manual</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="common-commands.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="baudrate-command.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><H1><ANAME="ALIAS-COMMAND">alias</H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN2927"></A><H2>Name</H2>alias -- Manipulate command line aliases</DIV><DIVCLASS="REFSYNOPSISDIV"><ANAME="AEN2930"><H2>Synopsis</H2><P><BCLASS="COMMAND">alias</B> {<TTCLASS="REPLACEABLE"><I> name</I></TT>} [<TTCLASS="REPLACEABLE"><I> value</I></TT>]</P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN2937"></A><H2>Arguments</H2><DIVCLASS="INFORMALTABLE"><ANAME="AEN2939"><P></P><TABLEBORDER="1"CLASS="CALSTABLE"><THEAD><TR><THWIDTH="25%"ALIGN="LEFT"VALIGN="TOP">Name</TH><THWIDTH="25%"ALIGN="LEFT"VALIGN="TOP">Type</TH><THWIDTH="25%"ALIGN="LEFT"VALIGN="TOP">Description</TH><THWIDTH="25%"ALIGN="LEFT"VALIGN="TOP">Default</TH></TR></THEAD><TBODY><TR><TDWIDTH="25%"ALIGN="LEFT"VALIGN="TOP"><TTCLASS="REPLACEABLE"><I>name</I></TT></TD><TDWIDTH="25%"ALIGN="LEFT"VALIGN="TOP">Name</TD><TDWIDTH="25%"ALIGN="LEFT"VALIGN="TOP">The name for this alias.</TD><TDWIDTH="25%"ALIGN="LEFT"VALIGN="TOP"><SPANCLASS="emphasis"><ICLASS="EMPHASIS">none</I></SPAN></TD></TR><TR><TDWIDTH="25%"ALIGN="LEFT"VALIGN="TOP"><TTCLASS="REPLACEABLE"><I>value</I></TT></TD><TDWIDTH="25%"ALIGN="LEFT"VALIGN="TOP">String</TD><TDWIDTH="25%"ALIGN="LEFT"VALIGN="TOP">Replacement value for the alias.</TD><TDWIDTH="25%"ALIGN="LEFT"VALIGN="TOP"><SPANCLASS="emphasis"><ICLASS="EMPHASIS">none</I></SPAN></TD></TR></TBODY></TABLE><P></P></DIV></DIV><DIVCLASS="REFSECT1"><ANAME="AEN2966"></A><H2>Description</H2><P>The <BCLASS="COMMAND">alias</B> command is used to maintain simple commandline aliases. These aliases are shorthand for longer expressions.When the pattern %{name} appears in a command line, including in a script,the corresponding value will be substituted. Aliases may be nested. </P><P>If no value is provided, then the current value of the alias is displayed. </P><P>If the system supports non-volatile configuration data via the <BCLASS="COMMAND">fconfig</B> command (see <AHREF="persistent-state-flash.html">the Section called <I>Persistent State Flash-based Configuration and Control</I> in Chapter 2</A>),then the value will be saved and used when the system is reset. </P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN2974"></A><H2>Examples</H2><P>Set an alias.<TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="SCREEN"> RedBoot> <TTCLASS="USERINPUT"><B>alias joe "This is Joe"</B></TT>Update RedBoot non-volatile configuration - continue (y/n)? n</PRE></TD></TR></TABLE> </P><P>Display an alias.<TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="SCREEN"> RedBoot> <TTCLASS="USERINPUT"><B>alias joe</B></TT>'joe' = 'This is Joe'</PRE></TD></TR></TABLE> </P><P>Use an alias. Note: the <BCLASS="COMMAND">"="</B> command simply echoes the command to to console.<TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="SCREEN"> RedBoot> <TTCLASS="USERINPUT"><B>= %{joe}</B></TT>This is Joe</PRE></TD></TR></TABLE></P><P>Aliases can be nested.<TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="SCREEN">RedBoot> <TTCLASS="USERINPUT"><B>alias frank "Who are you? %{joe}"</B></TT>Update RedBoot non-volatile configuration - continue (y/n)? nRedBoot> <TTCLASS="USERINPUT"><B>= %{frank}</B></TT>Who are you? This is Joe</PRE></TD></TR></TABLE></P><P>Notice how the value of %{frank} changes when %{joe} is changed sincethe value of %{joe} is not evaluated until %{frank} is evaluated.<TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="SCREEN">RedBoot> <TTCLASS="USERINPUT"><B>alias joe "This is now Josephine"</B></TT>Update RedBoot non-volatile configuration - continue (y/n)? nRedBoot> <TTCLASS="USERINPUT"><B>= %{frank}</B></TT>Who are you? This is now Josephine</PRE></TD></TR></TABLE> </P></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="common-commands.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="ecos-ref.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="baudrate-command.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Common Commands</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="common-commands.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">baudrate</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -