<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../general.ent">
  %general-entities;
]>

<sect1 id="ch-system-bash" role="wrap">
  <?dbhtml filename="bash.html"?>

  <sect1info condition="script">
    <productname>bash</productname>
    <productnumber>&bash-version;</productnumber>
    <address>&bash-url;</address>
  </sect1info>

  <title>Bash-&bash-version;</title>

  <indexterm zone="ch-system-bash">
    <primary sortas="a-Bash">Bash</primary>
  </indexterm>

  <sect2 role="package">
    <title/>

    <para>Bash 软件包包含 Bourne-Again SHell。</para>

    <segmentedlist>
      <segtitle>&buildtime;</segtitle>
      <segtitle>&diskspace;</segtitle>

      <seglistitem>
        <seg>&bash-ch6-sbu;</seg>
        <seg>&bash-ch6-du;</seg>
      </seglistitem>
    </segmentedlist>

  </sect2>

  <sect2 role="installation">
    <title>安装 Bash</title>
<!--
    <para>Incorporate some upstream fixes:</para>

<screen><userinput remap="pre">patch -Np1 -i ../&bash-fixes-patch;</userinput></screen>
-->
    <para>准备安装 Bash：</para>

<screen><userinput remap="configure">./configure --prefix=/usr                       \
            --docdir=/usr/share/doc/bash-&bash-version; \
            --without-bash-malloc               \
            --with-installed-readline</userinput></screen>

    <variablelist>
      <title>配置选项的含义：</title>

      <varlistentry>
        <term><parameter>--with-installed-readline</parameter></term>
        <listitem>
          <para>该选项告诉 Bash 使用系统中已经安装的 <filename
          class="libraryfile">readline</filename> 库，
          而不是它自己的 readline 版本。</para>
        </listitem>
      </varlistentry>

    </variablelist>

    <para>编译该软件包：</para>

<screen><userinput remap="make">make</userinput></screen>

    <para>如果不运行测试套件，跳到 <quote>安装该软件包</quote>。</para>

	<para>为了准备进行测试，确保
		<systemitem class="username">nobody</systemitem>
		用户可以写入源代码目录：</para>

<screen><userinput remap="test">chown -Rv nobody .</userinput></screen>

    <para>现在以 <systemitem class="username">nobody</systemitem>
    用户的身份运行测试：</para>

<screen><userinput remap="test">su nobody -s /bin/bash -c "PATH=$PATH make tests"</userinput></screen>

    <para>安装该软件包，并把主要的可执行文件移动到
    <filename class='directory'>/bin</filename>：</para>

<screen><userinput remap="install">make install
mv -vf /usr/bin/bash /bin</userinput></screen>

    <para>执行新编译的 <command>bash</command> 程序
    	（替换当前正在执行的版本）：</para>

<screen role="nodump"><userinput>exec /bin/bash --login +h</userinput></screen>

    <note>
      <para>上面使用的参数使得 <command>bash</command>
      进程是一个可交互的登录 shell ，并且仍然禁用散列功能，
      这样新程序一旦可用就会被找到。</para>
    </note>

  </sect2>

  <sect2 id="contents-bash" role="content">
    <title>Bash 的内容</title>

    <segmentedlist>
      <segtitle>安装的程序</segtitle>
      <segtitle>安装的目录</segtitle>

      <seglistitem>
        <seg>bash, bashbug, 以及 sh (到 bash 的链接)</seg>
        <seg>/usr/share/doc/bash-&bash-version;</seg>
      </seglistitem>
    </segmentedlist>

    <variablelist>
      <bridgehead renderas="sect3">简要描述</bridgehead>
      <?dbfo list-presentation="list"?>
      <?dbhtml list-presentation="table"?>

      <varlistentry id="bash">
        <term><command>bash</command></term>
        <listitem>
          <!--para>A widely-used command interpreter; it performs many types of
          expansions and substitutions on a given command line before executing
		  it, thus making this interpreter a powerful tool</para-->
	      <para>一个广泛使用的命令解释器；
			  它在执行命令前对命令行进行多种展开和替换操作，
			  这些操作使得它成为强大的工具。</para>
          <indexterm zone="ch-system-bash bash">
            <primary sortas="b-bash">bash</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="bashbug">
        <term><command>bashbug</command></term>
        <listitem>
          <para>一个 shell 脚本，用于帮助用户按照电子邮件标准格式编写关于
          	  <command>bash</command> 的 bug 报告</para>
          <indexterm zone="ch-system-bash bashbug">
            <primary sortas="b-bashbug">bashbug</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="sh">
        <term><command>sh</command></term>
        <listitem>
          <!--para>A symlink to the <command>bash</command> program; when invoked
          as <command>sh</command>, <command>bash</command> tries to mimic the
          startup behavior of historical versions of <command>sh</command> as
          closely as possible, while conforming to the POSIX standard as
          well</para-->
          <para>一个指向 <command>bash</command> 程序的符号链接；
			  当以 <command>sh</command> 命令运行时，
			  <command>bash</command> 试图尽可能地模仿
			  <command>sh</command> 的历史版本，以符合 POSIX 标准</para>
          <indexterm zone="ch-system-bash sh">
            <primary sortas="b-sh">sh</primary>
          </indexterm>
        </listitem>
      </varlistentry>

    </variablelist>

  </sect2>

</sect1>
