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

📄 0015-0016.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 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="0013-0014.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0017-0017.html">Next</A></CENTER></P>







<A NAME="PAGENUM-15"><P>Page 15</P></A>





<TABLE>



<TR><TD>

*

</TD><TD>

Expands to the positional parameters, starting from one. When the expansion occurs within

double quotes, it expands to a single word with the value of each parameter separated by the first

character of the IFS special variable. That is,

&quot;$*&quot; is equivalent to

&quot;$1c$2c...&quot;, where c is the first character

of the value of the IFS variable. If IFS is null or unset, the parameters are separated by spaces.

</TD></TR><TR><TD>

@

</TD><TD>

Expands to the positional parameters, starting from one. When the expansion occurs within

double quotes, each parameter expands as a separate word. That is,

&quot;$@&quot; is equivalent to &quot;$1&quot;&quot;$2&quot;

.... When there are no positional parameters,

&quot;$@&quot; and $@ expand to nothing (in other words, they

are removed).

</TD></TR><TR><TD>

#

</TD><TD>

Expands to the number of positional parameters in decimal.

</TD></TR><TR><TD>

?

</TD><TD>

Expands to the status of the most recently executed foreground pipeline.

</TD></TR><TR><TD>

_

</TD><TD>

Expands to the current option flags as specified upon invocation, by the

set built-in command, or those set by the shell itself (such as the

_i flag).

</TD></TR><TR><TD>

$

</TD><TD>

Expands to the process ID of the shell. In a

() subshell, it expands to the process ID of the

current shell, not the subshell.

</TD></TR><TR><TD>

!

</TD><TD>

Expands to the process ID of the most recently executed background (asynchronous) command.

</TD></TR><TR><TD>

0

</TD><TD>

Expands to the name of the shell or shell script. This is set at shell initialization. If

bash is invoked with a file of commands, is set to the name of that file. If

bash is started with the _c option, then is set to the first argument after the string to be executed, if one is present. Otherwise, it is set to

the pathname used to invoke bash, as given by argument zero.

</TD></TR><TR><TD>

_

</TD><TD>

Expands to the last argument to the previous command, after expansion. Also set to the

full pathname of each command executed and placed in the environment exported to that command.

</TD></TR></TABLE>



<P>

<b>SHELL VARIABLES</b>

</P>





<P>

The following variables are set by the shell:

</P>

<C>

PPID

<C>

The process ID of the shell's parent.

<C>

PWD

<C>

The current working directory as set by the

cd command.

<C>

OLDPWD

<C>

The previous working directory as set by the

cd command.

<C>

REPLY

<C>

Set to the line of input read by the

read built-in command when no arguments are supplied.

<C>

UID

<C>

Expands to the user ID of the current user, initialized at shell startup.

<C>

EUID

<C>

Expands to the effective user ID of the current user, initialized at shell startup.

<C>

BASH

<C>

Expands to the full pathname used to invoke this instance of

bash.

<C>

BASH_VERSION

<C>

Expands to the version number of this instance of

bash.

<C>

SHLVL

<C>

Incremented by one each time an instance of

bash is started.

<C>

RANDOM

<C>

Each time this parameter is referenced, a random integer is generated. The

sequence of random numbers may be initialized by assigning a value to

RANDOM. If RANDOM is unset, it loses its special properties, even if it is subsequently reset.

<C>

SECONDS

<C>

Each time this parameter is referenced, the number of seconds since shell

invocation is returned. If a value is assigned to

SECONDS, the value returned upon subsequent references is the number of seconds since the assignment plus the value assigned.

If SECONDS is unset, it loses its special properties, even if it is subsequently reset.

<C>

LINENO

<C>

Each time this parameter is referenced, the shell substitutes a decimal

number representing the current sequential line number (starting with 1) within a script

or function. When not in a script or function, the value substituted is not guaranteed

to be meaningful. When in a function, the value is not the number of the source

line that the command appears on (that information has been lost by the time

the function is executed), but is an approximation of the number of simple

commands executed in the current function. If

LINENO is unset, it loses its special properties,

even if it is subsequently reset.

</TBL>







<A NAME="PAGENUM-16"><P>Page 16</P></A>



<TABLE>



<TR><TD>

HISTCMD

</TD><TD>

The history number, or index in the history list, of the current command. If

HISTCMD is unset, it loses its special properties, even if it is subsequently reset.

</TD></TR><TR><TD>

OPTARG

</TD><TD>

The value of the last option argument processed by the

getopts built-in command. (See &quot;Shell Built-in Commands,&quot; later in this manual page).

</TD></TR><TR><TD>

OPTIND

</TD><TD>

The index of the next argument to be processed by the

getopts built-in command. (See &quot;Shell Built-in Commands.&quot;)

</TD></TR><TR><TD>

HOSTTYPE

</TD><TD>

Automatically set to a string that uniquely describes the type of machine on

which bash is executing. The default is system-dependent.

</TD></TR><TR><TD>

OSTYPE

</TD><TD>

Automatically set to a string that describes the operating system on which

bash is executing. The default is system-dependent.

</TD></TR></TABLE>







<P>The following variables are used by the shell. In some cases,

bash assigns a default value to a variable; these cases are noted

in the following list:

</P>





<TABLE>



<TR><TD>

IFS

</TD><TD>

The internal field separator that is used for word splitting after expansion and to

split lines into words with the read built-in command. The default value

is &lt;space&gt;&lt;tab&gt;&lt;newline&gt;.

</TD></TR><TR><TD>

PATH

</TD><TD>

The search path for commands. It is a colon-separated list of directories in which

the shell looks for commands. (See &quot;Command Execution,&quot; later in this manual

page). The default path is system_dependent, and is set by the administrator who

installs bash. A common value is /usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:

</TD></TR><TR><TD>

HOME

</TD><TD>

The home directory of the current user; the default argument for the

cd built-in command.

</TD></TR><TR><TD>

CDPATH

</TD><TD>

The search path for the cd command. This is a colon-separated list of directories

in which the shell looks for destination directories specified by the

cd command. A sample value is .:~:/usr.

</TD></TR><TR><TD>

ENV

</TD><TD>

If this parameter is set when bash is executing a shell script, its value is interpreted

as a filename containing commands to initialize the shell, as in

.bashrc. The value of ENV is subjected to parameter expansion, command substitution, and

arithmetic expansion before being interpreted as a pathname.

PATH is not used to search for the resultant pathname.

</TD></TR><TR><TD>

MAIL

</TD><TD>

If this parameter is set to a filename and the

MAILPATH variable is not set, bash informs the user of the arrival of mail in the specified file.

</TD></TR><TR><TD>

MAILCHECK

</TD><TD>

Specifies how often (in seconds)

bash checks for mail. The default is 60 seconds. When it is time to check for mail, the shell does so before prompting. If this

variable is unset, the shell disables mail checking.

</TD></TR><TR><TD>

MAILPATH

</TD><TD>

A colon-separated list of pathnames to be checked for mail. The message to

be printed may be specified by separating the pathname from the message with

a question mark (?). $_ stands for the name of the current mailfile.

</TD></TR></TABLE>





<!-- CODE SNIP //-->

<PRE>          Example:



                   MAILPATH\

                   ='/usr/spool/mail/bfox?&quot;You have

                   mail&quot;:~/shell-mail?&quot;$_has mail!&quot;'

</PRE>

<!-- END CODE SNIP //-->





<TABLE>



<TR><TD>

</TD><TD>

bash supplies a default value for this variable, but the location of the user mail

files that it uses is system-dependent (for example,

/usr/spool/mail/$USER).

</TD></TR><TR><TD>

MAIL_WARNING

</TD><TD>

If set, and a file that bash is checking for mail has been accessed since the last time

it was checked, the message &quot;The mail in mail-file has been read&quot; is printed.

</TD></TR><TR><TD>

PS1

</TD><TD>

The value of this parameter is expanded (see &quot;Prompting,&quot; later in this manual

page) and used as the primary prompt string. The default value is

bash\$.

</TD></TR><TR><TD>

PS2

</TD><TD>

The value of this parameter is expanded and used as the secondary prompt

string. The default is &gt;.

</TD></TR></TABLE>







<P><CENTER>

<a href="0013-0014.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0017-0017.html">Next</A></CENTER></P>







</td>
</tr>
</table>

<!-- begin footer information -->







</body></html>

⌨️ 快捷键说明

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