📄 0026-0027.html
字号:
<HTML>
<HEAD>
<TITLE>Linux Complete Command Reference:User Commands:EarthWeb Inc.-</TITLE>
</HEAD>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!-- ISBN=0672311046 //-->
<!-- TITLE=Linux Complete Command Reference//-->
<!-- AUTHOR=Red Hat//-->
<!-- PUBLISHER=Macmillan Computer Publishing//-->
<!-- IMPRINT=Sams//-->
<!-- CHAPTER=01 //-->
<!-- PAGES=0001-0736 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="0025-0025.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0028-0029.html">Next</A></CENTER></P>
<A NAME="PAGENUM-26"><P>Page 26</P></A>
<P>
replacing the old. The environment inherited by any executed command consists of the shell's initial environment,
whose values may be modified in the shell, less any pairs removed by the unset command, plus any additions via the export
and declare _x commands.</P>
<P>The environment for any simple command or function may be augmented temporarily by prefixing it with
parameter assignments, as described earlier in "Parameters." These assignment statements affect only the environment seen by
that command.</P>
<P>If the _k flag is set (see the set built-in command), then all parameter assignments are placed in the environment for
a command, not just those that precede the command name.</P>
<P>When bash invokes an external command, the variable is set to the full path name of the command and passed to
that command in its environment.</P>
<B>
<P>EXIT STATUS</P>
</B>
<P>For the purposes of the shell, a command which exits with a
zero exit status has succeeded. An exit status of
zero indicates success. A non_zero exit status indicates failure. When a command terminates on a fatal signal,
bash uses the value of 128+signal as the exit status.</P>
<P>If a command is not found, the child process created to execute it returns a status of
127. If a command is found but is not executable, the return status is
126.</P>
<P>bash itself returns the exit status of the last command executed, unless a syntax error occurs, in which case it exits with a
non_zero value. (See also the exit built-in command.)</P>
<B>
<P>PROMPTING</P>
</B>
<P>When executing interactively, bash displays the primary prompt
PS1 when it is ready to read a command, and the
secondary prompt PS2 when it needs more input to complete a command.
bash allows these prompt strings to be customized
by inserting a number of backslash-escaped special characters that are decoded as follows:</P>
<TABLE>
<TR><TD>
\t
</TD><TD>
The current time in HH:MM:SS format
</TD></TR><TR><TD>
\d
</TD><TD>
The date in "Weekday Month Date" format (for example, "Tue May 26")
</TD></TR><TR><TD>
\n
</TD><TD>
Newline
</TD></TR><TR><TD>
\s
</TD><TD>
The name of the shell, the basename of
$0 (the portion following the final slash)
</TD></TR><TR><TD>
\w
</TD><TD>
The current working directory
</TD></TR><TR><TD>
\W
</TD><TD>
The basename of the current working directory
</TD></TR><TR><TD>
\u
</TD><TD>
The username of the current user
</TD></TR><TR><TD>
\h
</TD><TD>
The hostname
</TD></TR><TR><TD>
\#
</TD><TD>
The command number of this command
</TD></TR><TR><TD>
\!
</TD><TD>
The history number of this command
</TD></TR><TR><TD>
\$
</TD><TD>
If the effective UID is 0, a #, otherwise a
$
</TD></TR><TR><TD>
\nnn
</TD><TD>
The character corresponding to the octal number
nnn
</TD></TR><TR><TD>
\\
</TD><TD>
A backslash
</TD></TR><TR><TD>
\[
</TD><TD>
Begin a sequence of nonprinting characters, which could be used to embed a terminal control
sequence into the prompt
</TD></TR><TR><TD>
\]
</TD><TD>
End a sequence of nonprinting characters
</TD></TR></TABLE>
<P>The command number and the history number are usually different: the history number of a command is its position in
the history list, which may include commands restored from the history file (see "History," later in this manual page), while
the command number is the position in the sequence of commands executed during the current shell session. After the string
is decoded, it is expanded via parameter expansion, command substitution, arithmetic expansion, and word splitting.
</P>
<A NAME="PAGENUM-27"><P>Page 27</P></A>
<B>
<P>READLINE</P>
</B>
<P>This is the library that handles reading input when using an interactive shell, unless the
_nolineediting option is given. By default, the line editing commands are similar to those of
emacs. A vi-style line editing interface is also available.</P>
<P>In this section, the emacs-style notation is used to denote keystrokes.
Control keys are denoted by C_key; for example,
C_n means Ctrl_N. Similarly, meta keys are denoted by
M_key, so M_x means Meta_X. (On keyboards without a meta key,
M_x means Esc-X; that is, press the Escape key, then the X key. This makes ESC the meta prefix. The combination
M_C_x means Esc_Control_x, or press the Escape key then hold the Control key while pressing the X key.)
</P>
<P>The default key-bindings may be changed with a
/.inputrc file. The value of the shell variable
INPUTRC, if set, is used instead of ~/.inputrc. Other programs that use this library may add their own commands and bindings.</P>
<P>For example, placing</P>
<!-- CODE SNIP //-->
<PRE>
M_Control_u: universal_argument
</PRE>
<!-- END CODE SNIP //-->
<P>or</P>
<!-- CODE SNIP //-->
<PRE>
C_Meta_u: universal_argument
</PRE>
<!-- END CODE SNIP //-->
<P>into the /.inputrc would make M_C_u execute the
readline command universal_argument.The following symbolic
character names are recognized: RUBOUT, DEL, ESC,
LFD, NEWLINE, RET, RETURN, SPC, SPACE, and TAB. In addition to command
names, readline allows keys to be bound to a string that is inserted when the key is pressed (a macro).</P>
<P>Readline is customized by putting commands in an initialization file. The name of this file is taken from the value of
the INPUTRC variable. If that variable is unset, the default is
~/.inputrc. When a program that uses the readline library starts
up, the init file is read, and the key bindings and variables are set. There are only a few basic constructs allowed in the
readline init file. Blank lines are ignored. Lines beginning with a
# are comments. Lines beginning with a $ indicate
conditional constructs. Other lines denote key bindings and variable settings.</P>
<P>The syntax for controlling key bindings in the
~/.inputrc file is simple. All that is required is the name of the command
or the text of a macro and a key sequence to which it should be bound. The name may be specified in one of two ways: as
a symbolic key name, possibly with Meta- or Control- prefixes, or as a key sequence. When using the form
keyname:function-name or macro, keyname is the name of a key spelled out in English. For example,</P>
<!-- CODE SNIP //-->
<PRE>
Control-u: universal_argument
Meta-Rubout: backward-kill-word
Control-o: ">&output"
</PRE>
<!-- END CODE SNIP //-->
<P>In the preceding example, C-u is bound to the function
universal_argument, M-DEL is bound to the function
backward_kill_word,and C-o is bound to run the macro expressed on the righthand side (that is, to insert the text
>&output into the line).</P>
<P>In the second form,
"keyseq":function-name or macro, keyseq differs from
keyname in that strings denoting an entire key sequence may be specified by placing the sequence within double quotes. Some GNU
emacs-style key escapes can be used, as in the following example:</P>
<!-- CODE SNIP //-->
<PRE>
"\C-u": universal_argument
"\C-x\C-r": re_read_init_file
"\e[11~": "Function Key 1"
</PRE>
<!-- END CODE SNIP //-->
<P>In this example, C-u is again bound to the function
universal_argument. C-x C-r is bound to the function
re_read_init_file, and ESC[11~ is bound to insert the text
Function Key 1. The full set of escape sequences is</P>
<TABLE>
<TR><TD>
\C_
</TD><TD>
Control prefix
</TD></TR><TR><TD>
\M-
</TD><TD>
Meta prefix
</TD></TR><TR><TD>
\e
</TD><TD>
An escape character
</TD></TR><TR><TD>
\\
</TD><TD>
Backslash
</TD></TR><TR><TD>
\"
</TD><TD>
Literal "
</TD></TR><TR><TD>
\'
</TD><TD>
Literal `
</TD></TR></TABLE>
<P><CENTER>
<a href="0025-0025.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0028-0029.html">Next</A></CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -