亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? _chapter 11.htm

?? linux、unix初學者的必讀書籍 詳細講述了shell編程方法與技巧
?? HTM
字號:
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Chapter 11</title>
<link rel="stylesheet" type="text/css" href="docsafari.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>

<body><table width="100%" border="1" bgcolor="#EBEBFF"><tr><td width="5%" align="left" valign="middle"><a href="_chapter 10.htm"><img src="Larrow.gif" width="17" height="19" border="0"></a></td><td align="center" valign="middle"><a class="docLink" href="Front matter.htm">CONTENTS</a></td><td width="5%" align="right" valign="middle"><a href="_chapter 12.htm"><img src="Rarrow.gif" width="17" height="19" border="0"></a></td></tr></table>


<h2 class="docChapterTitle">Chapter 11. The Interactive
<span class="docEmphasis">bash</span> Shell</h2><ul><li>&nbsp;<a class="docLink" href="#ch11lev1sec1">11.1 Introduction</a></li>
<li>&nbsp;<a class="docLink" href="#ch11lev1sec2">11.2 Command Line Shortcuts</a></li>
<li>&nbsp;<a class="docLink" href="#ch11lev1sec3">11.3 Variables</a></li>
<li>&nbsp;<a class="docLink" href="#ch11lev1sec4">BASH SHELL LAB EXERCISES</a></li>
</ul>
<p class="docText">
<img alt="graphics/ch11.gif" src="ch11.gif" border="0" width="500" height="448"></p>
<h3 class="docSection1Title" id="ch11lev1sec1">11.1 Introduction</h3>
<p class="docText">With an interactive shell, the standard input, output, and
error are tied to a terminal. When using the Bourne Again (<span class="docEmphasis">bash</span>)
shell interactively, you type UNIX commands at the <span class="docEmphasis">
bash</span> prompt and wait for a response. <span class="docEmphasis">Bash</span>
provides you with a large assortment of built-in commands and command line
shortcuts, such as history, aliases, file and command completion, command line
editing, and many more. Some of the features were present in the standard UNIX
Bourne shell but the GNU project has expanded the shell to include a number of
new features as well adding POSIX compliancy. With the release of
<span class="docEmphasis">bash</span> 2.x, so many features of the UNIX Korn
shell and C shell have been included that the <span class="docEmphasis">bash</span>
shell is a fully functional shell at both the interactive and programming level,
while upwardly compatible with the standard Bourne shell. For UNIX users,
<span class="docEmphasis">bash</span> offers an alternative to the standard
shells, <span class="docEmphasis">sh,</span> <span class="docEmphasis">csh,</span>
and <span class="docEmphasis">ksh.</span><span id="ENB11-1"><a class="docLink" href="#EN11-1"><sup>[1]</sup></a></span></p>
<p class="docText">This chapter focuses on how you interact with
<span class="docEmphasis">bash</span> at the command line and how to customize
your working environment. You will learn how to take advantage of all shortcuts
and built-in features in order to create an efficient and fun working
environment. The next chapter takes you a step further. Then you will be ready
to write <span class="docEmphasis">bash</span> shell scripts to further tailor
the working environment for yourself by automating everyday tasks and developing
sophisticated scripts, and if you are an administrator, doing the same not only
for yourself but also for whole groups of users.</p>
<h4 class="docSection2Title" id="ch11lev2sec1">11.1.1 Versions of <span class="docEmphasis">bash</span></h4>
<p class="docText">The Bourne Again shell is a Capricorn, born on January 10,
1988, fathered by Brian Fox and later adopted by Chet Ramey, who now officially
maintains <span class="docEmphasis">bash,</span> enhances it, and fixes bugs.
The first version of <span class="docEmphasis">bash</span> was 0.99. The current
version (as of this writing) is version 2.04. Major enhancements were completed
in version 2.0, but there are a num ber of operating systems that are still
using version 1.14.7. All versions are freely available under the GNU public
license. To see what version you are using, use the <span class="docEmphasis">-
-version</span> option to <span class="docEmphasis">bash</span> or print the
value of the <span class="docEmphasis">BASH_VERSION</span> environment variable.</p>
<h5 id="ch11list01" class="docExampleTitle">Example 11.1 </h5>
<pre>$ <span class="docEmphStrong">bash --version</span>
<span class="docEmphasis">GNU bash, version 2.03.0(1)-release (sparc-sun-solaris)</span>
<span class="docEmphasis">Copyright 1998 Free Software Foundation, Inc.</span>

$ <span class="docEmphStrong">echo $BASH_VERSION</span>
<span class="docEmphasis">2.03.0(1)-release</span>
</pre>
<h4 class="docSection2Title" id="ch11lev2sec2">11.1.2 Startup</h4>
<p class="docText">If the <span class="docEmphasis">bash</span> shell is your
login shell, it follows a chain of processes before you see a shell prompt.<span id="ENB11-2"><a class="docLink" href="#EN11-2"><sup>[2]</sup></a></span></p>
<center>
<h5 id="ch11fig01" class="docFigureTitle">Figure 11.1. Starting the <span class="docEmphasis">
bash</span> shell.</h5>
<p class="docText">
<img alt="graphics/11fig01.gif" src="11fig01.gif" border="0" width="500" height="602"></p>
</center>
<p class="docText">When the system boots, the first process to run is called
<span class="docEmphasis">init,</span> PID #1. It spawns a
<span class="docEmphasis">getty</span> process. This process opens up the
terminal ports, providing a place where standard input comes from and a place
where standard output and errors go, and puts a login prompt on your screen. The
<span class="docEmphasis">/bin/login</span> program is then executed. The
<span class="docEmphasis">login</span> program prompts for a password, encrypts
and verifies the password, sets up an initial environment, and starts up the
login shell, <span class="docEmphasis">/bin/bash,</span> the last entry in the
<span class="docEmphasis">passwd</span> file. The <span class="docEmphasis">bash</span>
process looks for the system file, <span class="docEmphasis">/etc/profile,</span>
and executes its commands. It then looks in the user's home directory for an
initialization file called <span class="docEmphasis">.bash_profile.</span> After
executing commands from <span class="docEmphasis">bash _profile,</span>
<span id="ENB11-3"><a class="docLink" href="#EN11-3"><sup>[3]</sup></a></span> it
will execute a command from the user's <span class="docEmphasis">ENV</span>
file, usually called <span class="docEmphasis">.bashrc,</span> and finally the
default dollar sign (<span class="docEmphasis">$</span>) prompt appears on your
screen and the shell waits for commands. (For more on initialization files, see
&quot;<a class="docLink" href="#ch11lev2sec3">The Environment</a>&quot;.)</p>
<p class="docText"><b>Changing the Shell at the Command Line.</b> If you want to
start another shell from the command line temporarily (without changing the
<span class="docEmphasis">/etc/passwd</span> file), just type the name of the
shell. For example, if you are currently using the standard Bourne shell and
would rather have <span class="docEmphasis">bash</span> as your shell, you can
change the shell at the command line simply by typing <span class="docEmphasis">
bash.</span></p>
<h5 id="ch11list02" class="docExampleTitle">Example 11.2 </h5>
<pre>1   $ <span class="docEmphStrong">ps</span>
    <span class="docEmphasis">PID   TTY    TIME   CMD</span>
    <span class="docEmphasis">1574  pts/6  0:00   sh</span>

2   $ <span class="docEmphStrong">bash</span>
    <span class="docEmphasis">bash-2.03$</span>

3   bash-2.03$ <span class="docEmphStrong">ps</span>
    <span class="docEmphasis">PID   TTY    TIME    CMD</span>
    <span class="docEmphasis">1574  pts/6  0:00    sh</span>
    <span class="docEmphasis">1576  pts/6  0:00    bash</span>
</pre>
<table cellSpacing="0" width="90%" border="1" align="center">
  <tr>
    <td>
    <h2 class="docSidebarTitle">EXPLANATION</h2>
    <span style="FONT-WEIGHT: bold">
    <ol class="docList" type="1">
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">The output of the <span class="docEmphasis">ps</span>
      command shows what processes are running. Currently,
      <span class="docEmphasis">sh</span> (the Bourne shell) is running.</span></li>
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">At the Bourne shell prompt, the user enters
      <span class="docEmphasis">bash</span> and starts up the Bourne Again
      shell. A new prompt appears.</span></li>
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">At the bash prompt, the <span class="docEmphasis">ps</span>
      command is executed. The output shows that two shells are running and the
      current shell is now <span class="docEmphasis">bash.</span></span></li>
    </ol>
    </span></td>
  </tr>
</table>
<h4 class="docSection2Title" id="ch11lev2sec3">11.1.3 The Environment</h4>
<p class="docText">The environment of a process consists of variables, open
files, the current working directory, functions, resource limits, signals, and
so forth. It defines those features that are inherited from one shell to the
next and the configuration for the working environment. The configuration for
the user's shell is defined in the shell initialization files.</p>
<p class="docText"><b>The Initialization Files.</b> The
<span class="docEmphasis">bash</span> shell has a number of startup files that
are sourced. Sourcing a file causes all settings in the file to become part of
the current shell; i.e., a subshell is not created. (The source command is
discussed in &quot;The source or dot Command&quot; on page 621.) The initialization files
are sourced depending on the whether the shell is a login shell, an interactive
shell (but not the login shell), or a noninteractive shell (a shell script).</p>
<p class="docText">When you log on, before the shell prompt appears, the
systemwide initialization file, <span class="docEmphasis">etc/profile,</span> is
sourced. Next, if it exists, the <span class="docEmphasis">.bash_profile</span>
in the user's home directory is sourced. It sets the user's aliases and
functions and then sets user-specific environment variables and startup scripts.</p>
<p class="docText">If the user doesn't have a <span class="docEmphasis">.bash_profile,</span>
but does have a file called <span class="docEmphasis">.bash_login,</span> that
file will be sourced, and if he doesn't have a <span class="docEmphasis">.bash_login,</span>
but does have a <span class="docEmphasis">.profile,</span> it will be sourced.
(The <span class="docEmphasis">.bash_login</span> file is similar to the C
shell's <span class="docEmphasis">.login</span> file and the
<span class="docEmphasis">.profile</span> is normally sourced by the Bourne
shell when it starts up.)</p>
<p class="docText">Here is a summary of the order that <span class="docEmphasis">
bash</span> processes its initialization files <span id="ENB11-4"><a class="docLink" href="#EN11-4"><sup>[4]</sup></a></span> (see
<a class="docLink" href="#ch11fig02">figure 11.2</a>):</p>
<center>
<h5 id="ch11fig02" class="docFigureTitle">Figure 11.2. Order of processing initialization
files.</h5>
<p class="docText">
<img alt="graphics/11fig02.gif" src="11fig02.gif" border="0" width="500" height="186"></p>
</center>
<pre>if <span class="docEmphasis">/etc/profile</span> exists, source it,
   if <span class="docEmphasis">~/.bash_profile</span> exists, source it,
      if  <span class="docEmphasis">~/.bashrc</span> exists, source it,
   else if <span class="docEmphasis">~/.bash_login</span> exists, source it,
   else if <span class="docEmphasis">~/.profile</span> exists, source it.
</pre>
<p class="docText"><span class="docEmphStrong">The <span class="docEmphasis">
/etc/profile</span> File.</span> The <span class="docEmphasis">/etc/profile</span>
file is a systemwide initialization file set up by the system administrator to
perform tasks when the user logs on. It is executed when the
<span class="docEmphasis">bash</span> shell starts up. It is also available to
all Bourne and Korn shell users on the system and normally performs such tasks
as checking the mail spooler for new mail and displaying the message of the day
from the <span class="docEmphasis">/etc/motd</span> file. (The following
examples will make more sense after you have completed this chapter.)</p>
<h5 id="ch11list03" class="docExampleTitle">Example 11.3 </h5>
<pre>(Sample <span class="docEmphasis">/etc/profile</span>)
<span class="docEmphasis"># /etc/profile</span>
<span class="docEmphasis"># Systemwide environment and startup programs</span>
<span class="docEmphasis"># Functions and aliases go in /etc/bashrc</span>

1  PATH=&quot;$PATH:/usr/X11R6/bin&quot;
2  PS1=&quot;[\u@\h \W]\\$ &quot;

3  ulimit -c 1000000
4  if [ 'id -gn' = 'id -un' -a 'id -u' -gt 14 ]; then
5    umask 002
   else
     umask 022
   fi

6  USER='id -un'
7  LOGNAME=$USER
8  MAIL=&quot;/var/spool/mail/$USER&quot;

9  HOSTNAME='/bin/hostname'
10 HISTSIZE=1000
11 HISTFILESIZE=1000
12 export PATH PS1 HOSTNAME HISTSIZE HISTFILESIZE USER LOGNAME MAIL

13  for i in /etc/profile.d/*.sh ; do
14      if [ -x $i ]; then
15           . $i
        fi
16  done

17  unset i #
</pre>
<table cellSpacing="0" width="90%" border="1" align="center">
  <tr>
    <td>
    <h2 class="docSidebarTitle">EXPLANATION</h2>
    <span style="FONT-WEIGHT: bold">
    <ol class="docList" type="1">
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">The <span class="docEmphasis">PATH</span> variable is
      assigned locations where the shell should search for commands.</span></li>
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">The primary prompt is assigned. It will be displayed in
      the shell window as the user's name (<span class="docEmphasis">\u</span>),the
      @ symbol, the host machine (<span class="docEmphasis">\W</span>), and a
      dollar sign.</span></li>
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">The <span class="docEmphasis">ulimit</span> command (a
      shell built-in command) is set to limit the maximum size of core files
      created to 1,000,000 bytes. Core files are memory dumps of programs that
      have crashed, and they take up a lot of disk space.</span></li>
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">This line reads, <span class="docEmphasis">if the
      user's group name is equal to the user's name and the user's ID number is
      greater than 14

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕一区二区日韩精品绯色| 午夜视频久久久久久| 亚洲精品国久久99热| 六月婷婷色综合| 在线视频一区二区三区| 久久久五月婷婷| 图片区日韩欧美亚洲| 成人av电影免费在线播放| 欧美一级久久久久久久大片| 日韩美女视频一区| 粉嫩av一区二区三区| 日韩美女在线视频| 亚洲一区二区三区四区不卡 | 亚洲人午夜精品天堂一二香蕉| 日本v片在线高清不卡在线观看| 99视频精品免费视频| 337p粉嫩大胆噜噜噜噜噜91av | 国产精品美女久久久久久| 美女久久久精品| 欧美精品丝袜中出| 亚洲色大成网站www久久九九| 国产一区二区三区免费看 | 欧美一区二区美女| 舔着乳尖日韩一区| 欧洲精品在线观看| 亚洲人成伊人成综合网小说| 不卡一区二区三区四区| 久久午夜免费电影| 国产在线日韩欧美| 精品国产伦一区二区三区观看体验| 亚洲国产精品综合小说图片区| 色综合久久88色综合天天免费| 蜜桃av一区二区在线观看| 欧美久久久久久蜜桃| 一区二区三区.www| 色屁屁一区二区| 一区二区三区四区视频精品免费 | 久久91精品国产91久久小草| 日韩三区在线观看| 久久99久久久欧美国产| 精品国偷自产国产一区| 国产在线视频精品一区| 久久精品人人做| 成人动漫中文字幕| 亚洲乱码国产乱码精品精可以看| 日本伦理一区二区| 五月天激情小说综合| 日韩一区二区三区在线| 国产麻豆一精品一av一免费| 国产精品素人视频| 色综合一个色综合| 日日夜夜精品视频免费| 精品福利在线导航| 成人综合激情网| 亚洲激情图片qvod| 欧美精品一卡二卡| 国产精品一级在线| 亚洲人妖av一区二区| 在线观看免费成人| 美腿丝袜在线亚洲一区| 国产欧美在线观看一区| 91免费版pro下载短视频| 亚洲一区二区三区视频在线播放 | 欧美主播一区二区三区| 日韩中文欧美在线| 国产午夜精品一区二区三区嫩草| 久久久综合网站| 91首页免费视频| 视频一区二区中文字幕| 精品动漫一区二区三区在线观看| 国产xxx精品视频大全| 一区二区三区在线视频免费观看| 欧美一级久久久久久久大片| 99精品一区二区三区| 七七婷婷婷婷精品国产| **性色生活片久久毛片| 欧美电影免费观看完整版| 91色在线porny| 久久精品久久久精品美女| 亚洲裸体在线观看| 26uuu精品一区二区| 欧美午夜不卡在线观看免费| 国产在线精品免费| 丝袜国产日韩另类美女| 亚洲欧美视频在线观看视频| 欧美精品一区二区三区视频| 欧美亚洲高清一区| 丁香婷婷综合激情五月色| 日韩高清一区在线| 伊人一区二区三区| 国产丝袜欧美中文另类| 国产精品123| 美女视频黄频大全不卡视频在线播放 | 免费人成精品欧美精品| 国产精品美日韩| 337p日本欧洲亚洲大胆色噜噜| 91精品福利视频| 国产精品乡下勾搭老头1| 午夜一区二区三区在线观看| 国产欧美一区二区三区沐欲| 一本到高清视频免费精品| 一区二区日韩电影| 综合久久久久久| 26uuu精品一区二区三区四区在线| 91蝌蚪porny九色| 国产不卡视频在线观看| 日韩电影在线观看一区| 亚洲欧洲精品一区二区三区不卡| 日韩欧美aaaaaa| 777xxx欧美| 91久久精品一区二区二区| 国产成人av一区| 看片的网站亚洲| 爽爽淫人综合网网站| 亚洲最大的成人av| 综合激情成人伊人| 国产午夜精品福利| 精品日韩一区二区| 91精品欧美综合在线观看最新 | 91精品国产综合久久福利| 色综合天天综合| av电影一区二区| 国产一区二三区| 高清成人免费视频| 国产99久久久精品| 国产精品99久久不卡二区| 久久er99精品| 国产一区二区三区精品欧美日韩一区二区三区| 国产精品国产精品国产专区不片| 国产精品成人在线观看| 国产精品久久三| 国产精品亲子伦对白| 国产精品国产成人国产三级 | 久久精品免费在线观看| 精品久久久久一区二区国产| 日韩一级高清毛片| 日韩一级免费观看| 精品国偷自产国产一区| 精品国产污网站| 国产精品毛片a∨一区二区三区| 国产拍揄自揄精品视频麻豆| 久久精品网站免费观看| 欧美激情在线看| 国产精品久久久久久一区二区三区 | 国产日韩在线不卡| 欧美国产精品劲爆| 亚洲素人一区二区| 亚洲一区二区三区激情| 亚洲素人一区二区| 麻豆视频一区二区| 国产精品一区不卡| 99久久精品免费精品国产| 在线视频亚洲一区| 波多野结衣中文一区| 成人国产精品免费| 欧美亚洲动漫精品| 日韩免费性生活视频播放| 专区另类欧美日韩| 日本亚洲免费观看| 国产精品一区在线观看你懂的| av在线这里只有精品| 欧美日韩亚洲国产综合| 欧美日韩中文字幕一区| 欧美高清在线精品一区| 亚洲一区二区在线观看视频 | 国产欧美日韩中文久久| 亚洲精品免费看| 亚洲18影院在线观看| 麻豆成人91精品二区三区| 91免费版pro下载短视频| 日韩午夜精品视频| 国产精品久久久久一区| 日韩精品亚洲专区| 成人国产视频在线观看| 精品久久久久av影院| 中文字幕亚洲不卡| 麻豆精品一区二区综合av| 99久久免费视频.com| 日韩一级在线观看| 国产精品进线69影院| 国产成人一级电影| 欧美精品日韩一本| 国产精品第13页| 激情六月婷婷综合| 99久久伊人网影院| 久久久久久久综合色一本| 五月激情综合色| 97精品视频在线观看自产线路二| 日韩一区二区三区观看| 亚洲自拍偷拍网站| 99国产一区二区三精品乱码| 精品国产一区二区三区四区四 | 欧美韩国日本不卡| 美女视频一区二区三区| 欧美日韩在线一区二区| 国产欧美在线观看一区| 懂色av一区二区三区蜜臀| wwwwww.欧美系列| 天天色综合成人网| 在线欧美小视频|