📄 ch06_09.htm
字号:
CLASS="emphasis">savehist</EM> (<ACLASS="linkend"HREF="ch11_11.htm"TITLE="Picking Up Where You Left Off ">11.11</A>)</SPAN><ACLASS="indexterm"NAME="AUTOID-6423"></A>variable stores the number of lines of shell history to be saved when you log out. This amount of history is saved ina file called <EMCLASS="emphasis">.history</EM> in your home directory, andthe lines are restored the next time you log in.</P></LI><LICLASS="listitem"><PCLASS="para">If you set<ACLASS="indexterm"NAME="AUTOID-6428"></A><SPANCLASS="link"><EMCLASS="emphasis">ignoreeof</EM> (<ACLASS="linkend"HREF="ch03_05.htm"TITLE="Stop Accidental C Shell Logouts ">3.5</A>)</SPAN>,the shell won't respond to the end-of-file character (CTRL-d) and willrequire you to type <CODECLASS="literal">logout</CODE> or<SPANCLASS="link"><CODECLASS="literal">exit</CODE> (<ACLASS="linkend"HREF="ch38_04.htm"TITLE="Subshells ">38.4</A>)</SPAN>to log out.This can save you from ending the shell accidentally (or logging out).</P></LI><LICLASS="listitem"><PCLASS="para">The shell can tell you about new<SPANCLASS="link">electronic mail (<ACLASS="linkend"HREF="ch01_33.htm"TITLE="UNIX Networking and Communications ">1.33</A>)</SPAN>or changes in other files with the<SPANCLASS="link"><EMCLASS="emphasis">mail</EM> (<ACLASS="linkend"HREF="ch21_08.htm"TITLE="The MAILCHECK and mail Variables Check More than Mail">21.8</A>)</SPAN><ACLASS="indexterm"NAME="AUTOID-6440"></A>variable.</P></LI><LICLASS="listitem"><PCLASS="para">Stop the <CODECLASS="literal">></CODE> redirection character from overwriting files with<ACLASS="indexterm"NAME="AUTOID-6445"></A><ACLASS="indexterm"NAME="AUTOID-6448"></A><ACLASS="indexterm"NAME="AUTOID-6451"></A><SPANCLASS="link"><EMCLASS="emphasis">noclobber</EM> (<ACLASS="linkend"HREF="ch13_06.htm"TITLE="Safe I/O Redirection with noclobber ">13.6</A>)</SPAN>.</P></LI><LICLASS="listitem"><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-6457"></A>The <EMCLASS="emphasis">noglob</EM>variable stops<SPANCLASS="link">wildcard expansion (<ACLASS="linkend"HREF="ch15_01.htm#UPT-ART-1480"TITLE="File Naming Wildcards ">15.1</A>)</SPAN>.(There's an example in article<ACLASS="xref"HREF="ch05_04.htm"TITLE="Setting the TERMCAP Variable with tset ">5.4</A>.)</P></LI><LICLASS="listitem"><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-6464"></A>Set <EMCLASS="emphasis">nonomatch</EM>when you want the C shell totreat nonmatching wildcards<SPANCLASS="link"> like the Bourne shell does . (<ACLASS="linkend"HREF="ch15_04.htm"TITLE="What if a Wildcard Doesn't Match? ">15.4</A>)</SPAN></P></LI><LICLASS="listitem"><PCLASS="para">The <ACLASS="indexterm"NAME="AUTOID-6470"></A><SPANCLASS="link"><EMCLASS="emphasis">notify</EM> (<ACLASS="linkend"HREF="ch12_06.htm"TITLE="Notification When Jobs Change State ">12.6</A>)</SPAN>variable asks the shell to tell you right away if abackground job finishes or is stopped.</P></LI><LICLASS="listitem"><PCLASS="para">The list of directories that the shell searches for commands is stored in <ACLASS="indexterm"NAME="AUTOID-6476"></A><SPANCLASS="link"><EMCLASS="emphasis">path</EM> (<ACLASS="linkend"HREF="ch06_05.htm"TITLE="PATH and path ">6.5</A>)</SPAN>.</P></LI><LICLASS="listitem"><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-6482"></A><ACLASS="indexterm"NAME="AUTOID-6484"></A>Your login name from the<SPANCLASS="link"><EMCLASS="emphasis">USER</EM> or <EMCLASS="emphasis">LOGNAME</EM> (<ACLASS="linkend"HREF="ch06_03.htm"TITLE="Predefined Environment Variables ">6.3</A>)</SPAN>environment variable is also storedin the C shell variable named <EMCLASS="emphasis">user</EM>.</P></LI><LICLASS="listitem"><PCLASS="para">The shell's command-line prompt is set by the <ACLASS="indexterm"NAME="AUTOID-6492"></A><SPANCLASS="link"><EMCLASS="emphasis">prompt</EM> (<ACLASS="linkend"HREF="ch07_02.htm"TITLE="Basics of Setting the Prompt ">7.2</A>)</SPAN>variable.(The<SPANCLASS="link"><EMCLASS="emphasis">PS1</EM> (<ACLASS="linkend"HREF="ch06_03.htm"TITLE="Predefined Environment Variables ">6.3</A>)</SPAN><ACLASS="indexterm"NAME="AUTOID-6498"></A><ACLASS="indexterm"NAME="AUTOID-6500"></A>environment variable is the Bourne shell equivalent.You can set the Bourne shell's<SPANCLASS="link">secondary prompt (<ACLASS="linkend"HREF="ch09_13.htm"TITLE="Multiline Commands, Secondary Prompts ">9.13</A>)</SPAN>,too, in <EMCLASS="emphasis">PS2</EM>.) </P></LI><LICLASS="listitem"><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-6506"></A><ACLASS="indexterm"NAME="AUTOID-6509"></A><ACLASS="indexterm"NAME="AUTOID-6511"></A>The<SPANCLASS="link">exit status (<ACLASS="linkend"HREF="ch44_07.htm"TITLE="Exit Status of UNIX Processes ">44.7</A>)</SPAN>of the last command is stored in the <EMCLASS="emphasis">csh</EM> variable named <EMCLASS="emphasis">status</EM>and the <EMCLASS="emphasis">sh</EM> <EMCLASS="emphasis">?</EM> (question mark) variable.</P></LI><LICLASS="listitem"><PCLASS="para">If a job takes more CPU seconds than the number set in the <ACLASS="indexterm"NAME="AUTOID-6521"></A><SPANCLASS="link"><EMCLASS="emphasis">time</EM> (<ACLASS="linkend"HREF="ch39_03.htm"TITLE="The csh time variable ">39.3</A>)</SPAN>variable, the <EMCLASS="emphasis">csh</EM> will print a line of statistics about the job.</P></LI></UL><DIVCLASS="sect1info"><PCLASS="SECT1INFO">- <SPANCLASS="authorinitials">JP</SPAN>, <SPANCLASS="authorinitials">TOR</SPAN></P></DIV></DIV><DIVCLASS="htmlnav"><P></P><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch06_08.htm"TITLE="6.8 Shell Variables "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 6.8 Shell Variables "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="book"HREF="index.htm"TITLE="UNIX Power Tools"><IMGSRC="gifs/txthome.gif"SRC="gifs/txthome.gif"ALT="UNIX Power Tools"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch06_10.htm"TITLE="6.10 Running a Command with a Temporarily Different Environment "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 6.10 Running a Command with a Temporarily Different Environment "BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172">6.8 Shell Variables </TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="index"HREF="index/idx_0.htm"TITLE="Book Index"><IMGSRC="gifs/index.gif"SRC="gifs/index.gif"ALT="Book Index"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172">6.10 Running a Command with a Temporarily Different Environment </TD></TR></TABLE><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><IMGSRC="gifs/smnavbar.gif"SRC="gifs/smnavbar.gif"USEMAP="#map"BORDER="0"ALT="The UNIX CD Bookshelf Navigation"><MAPNAME="map"><AREASHAPE="RECT"COORDS="0,0,73,21"HREF="../index.htm"ALT="The UNIX CD Bookshelf"><AREASHAPE="RECT"COORDS="74,0,163,21"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="164,0,257,21"HREF="../unixnut/index.htm"ALT="UNIX in a Nutshell"><AREASHAPE="RECT"COORDS="258,0,321,21"HREF="../vi/index.htm"ALT="Learning the vi Editor"><AREASHAPE="RECT"COORDS="322,0,378,21"HREF="../sedawk/index.htm"ALT="sed & awk"><AREASHAPE="RECT"COORDS="379,0,438,21"HREF="../ksh/index.htm"ALT="Learning the Korn Shell"><AREASHAPE="RECT"COORDS="439,0,514,21"HREF="../lrnunix/index.htm"ALT="Learning the UNIX Operating System"></MAP></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -