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

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

?? _chapter 10.htm

?? linux、unix初學者的必讀書籍 詳細講述了shell編程方法與技巧
?? HTM
?? 第 1 頁 / 共 3 頁
字號:
<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 10</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 9.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 11.htm"><img src="Rarrow.gif" width="17" height="19" border="0"></a></td></tr></table>


<h2 class="docChapterTitle">Chapter 10. The Korn Shell</h2><ul><li>&nbsp;<a class="docLink" href="#ch10lev1sec1">10.1 Interactive Korn Shell</a></li>
<li>&nbsp;<a class="docLink" href="#ch10lev1sec2">10.2 Programming with the Korn Shell</a></li>
<li>&nbsp;<a class="docLink" href="#ch10lev1sec3">KORN SHELL LAB EXERCISES</a></li>
</ul>
<center>
<p class="docText">
<img alt="graphics/ch10.gif" src="ch10.gif" border="0" width="484" height="613"></p>
</center>
<h3 class="docSection1Title" id="ch10lev1sec1">10.1 Interactive Korn Shell</h3>
<p class="docText">Before the Korn shell displays a prompt, it is preceded by a
number of processes. See <a class="docLink" href="#ch10fig01">Figure 10.1</a>.</p>
<center>
<h5 id="ch10fig01" class="docFigureTitle">Figure 10.1. System startup and the Korn shell.</h5>
<p class="docText">
<img alt="graphics/10fig01.gif" src="10fig01.gif" border="0" width="420" height="496"></p>
</center>
<h4 class="docSection2Title" id="ch10lev2sec1">10.1.1 Startup</h4>
<p class="docText">The first process to run is called <span class="docEmphasis">
init,</span> PID 1. It gets instructions from a file called
<span class="docEmphasis">inittab</span> (System V) or spawns a
<span class="docEmphasis">getty</span> (BSD) process. These processes open up
the terminal ports, provide a place where input comes from,
<span class="docEmphasis">stdin,</span> and the place where standard output (<span class="docEmphasis">stdout</span>)
and standard error (<span class="docEmphasis">stderr</span>) go, and put 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 you
for a password, encrypts and verifies the password, sets up an initial
environment, and starts up the login shell, <span class="docEmphasis">/bin/ksh,</span>
the last entry in the <span class="docEmphasis">passwd</span> file. The
<span class="docEmphasis">ksh</span> program 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">.profile,</span> and an environment file,
conventionally called <span class="docEmphasis">.kshrc.</span> After executing
commands from those files, the dollar sign prompt appears on your screen and the
Korn shell awaits commands.</p>
<h4 class="docSection2Title" id="ch10lev2sec2">10.1.2 The Environment</h4>
<p class="docText"><b>The Initialization Files.</b> After executing the commands
in <span class="docEmphasis">/etc/profile,</span> the initialization files in
the user's home directory are executed. The <span class="docEmphasis">.profile</span>
is executed, followed by the <span class="docEmphasis">ENV</span> file, commonly
called the <span class="docEmphasis">.kshrc</span> file.</p>
<p class="docText"><span class="docEmphStrong">The <span class="docEmphasis">
/etc/profile</span> File.</span> The <span class="docEmphasis">/etc/profile</span>
is a systemwide readable file set up by the system administrator to perform
tasks when the user logs on and the Korn shell starts up. It is 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 text is
an example of the /etc/<span class="docEmphasis">profile.</span> See
<a class="docLink" href="_chapter 8.htm">Chapter 8, &quot;The
Interactive Bourne Shell,&quot;</a> for a complete explanation of each line of
<span class="docEmphasis">/etc/profile.</span></p>
<pre>EXAMPLE
<span class="docEmphasis"># The profile that all logins get before using their own .profile</span>
    trap &quot; &quot; 2 3
    export LOGNAME PATH  <span class="docEmphasis"># Initially set by /bin/login</span>
    if [ &quot;$TERM&quot; = &quot; &quot; ]
    then
       if /bin/i386
       then     <span class="docEmphasis"># Set the terminal type</span>
          TERM=AT386
       else
          TERM=sun
       fi
       export TERM
    fi
    <span class="docEmphasis"># Login and -su shells get /etc/profile services.</span>
    <span class="docEmphasis"># -rsh is given its environment in the .profile.</span>
    case &quot;$0&quot; in
    -sh | <span class="docEmphStrong">-ksh</span> | -jsh )
        if [ ! -f .hushlogin ]
        then
          /usr/sbin/quota
       <span class="docEmphasis">#</span> Allow the user to break the Message-Of-The-Day only.
          trap &quot;trap ' ' 2&quot; 2
          /bin/cat -s /etc/motd
          <span class="docEmphasis"># Display the message of the day</span>
          trap &quot; &quot; 2
          /bin/mail -E
          case $? in
          0)        <span class="docEmphasis"># Check for new mail</span>
              echo &quot;You have new mail. &quot;
                   ;;
          2)  echo &quot;You have mail. &quot;
                   ;;
          esac
       fi
    esac
    umask 022
    trap 2 3
</pre>
<p class="docText"><span class="docEmphStrong">The <span class="docEmphasis">
.profile</span> File.</span> The <span class="docEmphasis">.profile</span> file
is a user-defined initialization file, that is executed once at login (by the
Bourne and Korn shells) and is found in your home directory. It gives you the
ability to customize and modify your working environment. Environment variables
and terminal settings are normally set here, and if a window application or
<span class="docEmphasis">dbm</span> is to be initiated, it is started here. If
the <span class="docEmphasis">.profile</span> file contains a special variable
called <span class="docEmphasis">ENV,</span> the filename that is assigned to
that variable will be executed next. The <span class="docEmphasis">ENV</span>
file is often named <span class="docEmphasis">.kshrc;</span> it contains aliases
and <span class="docEmphasis">set 杘</span> commands. The
<span class="docEmphasis">ENV</span> file is executed every time a
<span class="docEmphasis">ksh</span> subshell is spawned. The lines from the
following files may not be meaningful to you now, but all of the concepts, such
as exporting variables, history, the search path, and so on, will be discussed
in detail throughout the text of this book.</p>
<h5 id="ch10list01" class="docExampleTitle">Example 10.1 </h5>
<pre>1   set -o allexport
2   TERM=vt102
3   HOSTNAME=$(uname -n)
4   HISTSIZE=50
5   EDITOR=/usr/ucb/vi
6   ENV=$HOME/.kshrc
7   PATH=$HOME/bin:/usr/ucb:/usr/bin:\
    /usr/local:/etc:/bin:/usr/bin:/usr/local\
    /bin:/usr/hosts:/usr/5bin:/usr/etc:/usr/bin:.
8   PS1=&quot;$HOSTNAME ! $ &quot;
9   set +o allexport
10  alias openwin=/usr/openwin/bin/openwin
11  trap '$HOME/.logout' EXIT
12  clear
</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">By setting the <span class="docEmphasis">allexport</span>
      option, all variables created will automatically be exported (made
      available to subshells).</span></li>
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">The terminal is set to <span class="docEmphasis">vt102.</span></span></li>
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">The variable <span class="docEmphasis">HOSTNAME</span>
      is assigned the name of this machine, <span class="docEmphasis">$(uname
      杗).</span></span></li>
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">The <span class="docEmphasis">HISTSIZE</span> variable
      is assigned <span class="docEmphasis">50;</span> 50 lines from the history
      file will be displayed on the terminal when the user types
      <span class="docEmphasis">history.</span></span></li>
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">The <span class="docEmphasis">EDITOR</span> variable is
      assigned the pathname for the <span class="docEmphasis">vi</span> editor.
      Programs such as <span class="docEmphasis">mail</span> allow you to select
      an editor in which to work.</span></li>
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">The <span class="docEmphasis">ENV</span> variable is
      assigned the path to the home directory (<span class="docEmphasis">$HOME</span>)
      and the name of the file that contains further Korn shell customization
      settings. After the <span class="docEmphasis">.profile</span> is executed,
      the <span class="docEmphasis">ENV</span> file is executed. The name of the
      <span class="docEmphasis">ENV</span> file is your choice; it is commonly
      called <span class="docEmphasis">.kshrc.</span></span></li>
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">The search path is defined. It is a colon-separated
      list of directories used by the shell in its search for commands typed at
      the prompt or in a script file. The shell searches each element of the
      path from left to right for the command. The dot at the end represents the
      current working directory. If the command cannot be found in any of the
      listed directories, the shell will look in the current directory.</span></li>
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">The primary prompt, by default a dollar sign ($), is
      set to the name of the host machine, the number of the current command in
      the history file, and a dollar sign (<span class="docEmphasis">$</span>).</span></li>
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">The <span class="docEmphasis">allexport</span> option
      is turned off.</span></li>
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">An alias is a nickname for a command. The alias for
      <span class="docEmphasis">openwin</span> is assigned the full pathname of
      the <span class="docEmphasis">openwin</span> command, which starts Sun's
      window application.</span></li>
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">The <span class="docEmphasis">trap</span> command will
      execute the <span class="docEmphasis">.logout</span> file when you exit
      this shell, that is, when you log out. The <span class="docEmphasis">
      .logout</span> file is a user-defined file containing commands that are
      executed at the time of logging out. For example, you may want to record
      the time you log out, clean up a temporary file, or simply say
      <span class="docEmphasis">So long.</span></span></li>
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">The <span class="docEmphasis">clear</span> command
      clears the screen.</span></li>
    </ol>
    </span></td>
  </tr>
</table>

<p class="docText"><span class="docEmphStrong">The <span class="docEmphasis">ENV</span>
File.</span> The <span class="docEmphasis">ENV</span> variable is assigned the
name of a file that will be executed every time an interactive
<span class="docEmphasis">ksh</span> or <span class="docEmphasis">ksh</span>
program (script) is started. The <span class="docEmphasis">ENV</span> variable
is set in the <span class="docEmphasis">.profile</span> and is assigned the name
of the file that will contain special <span class="docEmphasis">ksh</span>
variables and aliases. The name is conventionally <span class="docEmphasis">.kshrc,</span>
but you can call it anything you want. (The <span class="docEmphasis">ENV</span>
file is not processed when the privileged option is on. See
<a class="docLink" href="#ch10table01">Table 10.1</a>.)</p>
<h5 id="ch10list02" class="docExampleTitle">Example 10.2 </h5>
<pre>1   set -o trackall
2   set -o vi
3   alias l='ls -laF'
    alias ls='ls -aF'
    alias hi='fc -l'
    alias c=clear
4   function pushd { pwd &gt; $HOME/.lastdir.$$ ; }
    function popd { cd $(&lt; $HOME/.lastdir.$$) ;
           rm $HOME/.lastdir.$$; pwd; }
    function psg { ps -ef | egrep $1 | egrep -v egrep; }
    function vg { vgrind -s11 -t $* | lpr -t ; }
</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">set</span> option for
      tracked aliases is turned on. (For a complete description, see &quot;<a class="docLink" href="#ch10lev2sec8">Aliases</a>&quot;.)</span></li>
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">The <span class="docEmphasis">set</span> option for the
      <span class="docEmphasis">vi</span> editor is turned on for in-line
      editing of the history file. (See &quot;<a class="docLink" href="#ch10lev2sec6">Command
      Line History</a>&quot;.)</span></li>
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">The aliases (nicknames) for the commands are defined.</span></li>
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">The functions are named and defined. (See &quot;<a class="docLink" href="#ch10lev2sec16">Functions</a>&quot;.)</span></li>
    </ol>
    </span></td>
  </tr>
</table>

<p class="docText"><span class="docEmphStrong">The <span class="docEmphasis">set
杘</span> Options.</span> The <span class="docEmphasis">set</span> command can
take options if the <span class="docEmphasis">杘</span> switch is used. Options
allow you to customize the shell environment. They are either on or off, and are
normally set in the <span class="docEmphasis">ENV</span> file.</p>

<table cellSpacing="0" width="90%" border="1" align="center">
  <tr>
    <td>
    <h2 class="docSidebarTitle">FORMAT</h2>
    <pre>set -o option  Turns on the option.
set +o option  Turns off the option
set -[a-z] Abbreviation for an option; the minus turns it on
set +[a-z] Abbreviation for an option; the plus turns it off
</pre>
    </td>
  </tr>
</table>

<h5 id="ch10list03" class="docExampleTitle">Example 10.3 </h5>
<pre>set -o allexport
set +o allexport
set -a
set +a
</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">Sets the <span class="docEmphasis">allexport</span>
      option. This option causes all variables to be automatically exported to
      subshells.</span></li>
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">Unsets the <span class="docEmphasis">allexport</span>
      option. All variables will now be local to the current shell.</span></li>
      <li><span style="FONT-WEIGHT: normal">
      <p class="docList">Sets the <span class="docEmphasis">allexport</span>
      option. Same as 1. Not every option has an abbreviation (see

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品国产亚洲5555| 国产精品第13页| 视频一区免费在线观看| 欧美日韩一区二区三区视频| 天天综合网 天天综合色| 欧美日韩国产精品自在自线| 日韩国产精品久久久久久亚洲| 欧美精品一二三| 黄网站免费久久| 国产精品不卡视频| 在线精品视频一区二区三四| 婷婷丁香久久五月婷婷| 久久综合色8888| 不卡的av网站| 蜜桃视频免费观看一区| 国产亚洲一区二区在线观看| proumb性欧美在线观看| 一区二区三区不卡视频| 欧美一区国产二区| 成人久久久精品乱码一区二区三区| 亚洲精品菠萝久久久久久久| 91精品国产综合久久福利| 国产乱码精品一区二区三区av| 亚洲欧洲日本在线| 538prom精品视频线放| 国产盗摄女厕一区二区三区| 一区二区三区日韩精品| 欧美成人aa大片| 99视频在线观看一区三区| 日韩国产欧美视频| 亚洲欧美一区二区三区孕妇| 欧美一区二区在线免费观看| 成人视屏免费看| 日韩高清电影一区| 日韩一区在线免费观看| 欧美成人三级电影在线| 91天堂素人约啪| 黄色资源网久久资源365| 一区二区三区在线视频观看58| www久久久久| 欧美日韩中文一区| 成人av在线播放网站| 蜜臀久久久99精品久久久久久| 自拍偷拍亚洲欧美日韩| 久久奇米777| 欧美理论片在线| 色综合久久六月婷婷中文字幕| 久久精品国产亚洲高清剧情介绍| 一二三四区精品视频| 国产女同性恋一区二区| 欧美电视剧在线看免费| 欧美久久久久中文字幕| 99精品视频中文字幕| 国产精品亚洲综合一区在线观看| 天堂在线一区二区| 一区二区日韩av| 国产精品久久看| 国产欧美精品一区二区三区四区| 日韩女优制服丝袜电影| 欧美日韩精品一区二区三区四区| 99精品视频一区二区三区| 国产精品99久久久久久似苏梦涵 | 国产成人综合亚洲91猫咪| 亚洲成人精品在线观看| 亚洲人被黑人高潮完整版| 欧美极品少妇xxxxⅹ高跟鞋 | 国产不卡在线播放| 韩国av一区二区三区四区| 三级成人在线视频| 亚洲成人精品在线观看| 亚洲成人av福利| 亚洲成年人网站在线观看| 亚洲国产综合色| 亚洲五月六月丁香激情| 亚洲一级二级在线| 久久se精品一区精品二区| 美女www一区二区| 美女mm1313爽爽久久久蜜臀| 久久精品72免费观看| 麻豆91精品91久久久的内涵| 精品中文字幕一区二区| 国产最新精品精品你懂的| 国产精一区二区三区| 成人性生交大片| 99国内精品久久| 欧洲亚洲国产日韩| 8x8x8国产精品| 欧美mv和日韩mv国产网站| 欧美va亚洲va| 日韩欧美成人午夜| 久久久99精品免费观看不卡| 国产精品午夜在线观看| 自拍偷在线精品自拍偷无码专区| 亚洲精品一卡二卡| 五月婷婷综合激情| 免费观看成人av| 粉嫩蜜臀av国产精品网站| 成人av在线影院| 欧美系列在线观看| 欧美一级国产精品| 欧美国产精品v| 夜夜嗨av一区二区三区网页 | 欧美—级在线免费片| 亚洲日本乱码在线观看| 午夜激情一区二区| 国产一区在线不卡| 91麻豆产精品久久久久久| 在线一区二区视频| 精品福利一区二区三区| 国产精品蜜臀av| 丝袜国产日韩另类美女| 国产一区二区成人久久免费影院| 色屁屁一区二区| 久久综合九色综合欧美就去吻| 中文字幕一区二区不卡| 视频在线观看一区二区三区| 国产美女精品人人做人人爽| 色狠狠一区二区| 精品美女被调教视频大全网站| 国产精品久久福利| 日本中文在线一区| 欧美日本免费一区二区三区| 久久久国产午夜精品| 亚洲制服丝袜av| 国产美女久久久久| 欧美精品一级二级| 亚洲免费观看视频| 国产精品自在欧美一区| 欧美日韩国产乱码电影| 亚洲少妇最新在线视频| 国产一区二区三区最好精华液| 欧洲一区二区三区免费视频| 欧美激情一区在线| 久久er99热精品一区二区| 91成人免费电影| 亚洲欧洲成人自拍| 国产一区 二区| 在线电影一区二区三区| 亚洲激情图片一区| 成人综合婷婷国产精品久久蜜臀 | 一区二区三区欧美| 国产盗摄精品一区二区三区在线| 欧美一区二区在线免费播放| 亚洲一区二区欧美| 91视频观看免费| 国产精品区一区二区三| 国产资源精品在线观看| 日韩免费一区二区三区在线播放| 亚洲无人区一区| 在线视频亚洲一区| 亚洲视频一二区| 99精品久久只有精品| 欧美极品少妇xxxxⅹ高跟鞋| 国产精品一区二区男女羞羞无遮挡| 欧美一级精品大片| 男女男精品视频| 日韩一卡二卡三卡| 美洲天堂一区二卡三卡四卡视频| 欧美日韩mp4| 日韩综合一区二区| 在线播放一区二区三区| 日韩精品乱码免费| 欧美一区二区视频网站| 日韩电影网1区2区| 日韩欧美电影一区| 国产一区二区三区黄视频 | 91久久精品一区二区| 亚洲欧美在线另类| 91啪亚洲精品| 亚洲一区二区在线播放相泽 | 午夜不卡av免费| 欧美精品久久99| 成人精品国产免费网站| 国产精品不卡一区二区三区| 99久免费精品视频在线观看| 亚洲丝袜自拍清纯另类| 一本到三区不卡视频| 亚洲一区二区在线免费观看视频 | 国产精品久久久久久久久久久免费看| 国产精华液一区二区三区| 日本一区二区三区四区在线视频| 成人性生交大片| 一区二区三区欧美视频| 91精品国产91久久久久久一区二区| 奇米精品一区二区三区在线观看| 精品久久国产老人久久综合| 国产suv精品一区二区6| 国产精品久久久久久亚洲伦| 色婷婷av一区二区三区之一色屋| 亚洲国产精品精华液网站| 91精品国产手机| 国产成人综合自拍| 亚洲精品自拍动漫在线| 69久久99精品久久久久婷婷| 久久精品免费观看| 国产精品久久午夜| 精品视频一区二区不卡| 久久国产精品99久久人人澡| 国产精品日日摸夜夜摸av| 91九色02白丝porn|