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

📄 abs-book.sgml

📁 一本完整的描述Unix Shell 编程的工具书的所有范例
💻 SGML
📖 第 1 页 / 共 5 页
字号:
	<varlistentry><term><token>.</token></term>	  <indexterm>	    <primary>.</primary>	  </indexterm>	  <indexterm>	    <primary>special character</primary>	    <secondary>.</secondary>	  </indexterm>	  <indexterm>	    <primary>character match</primary>	  </indexterm>	  	  <indexterm>	    <primary>match single character</primary>	  </indexterm>	  	  <listitem>	    <formalpara><title><quote>dot</quote> character match</title>	      <para>When <link linkend="regexdot">matching	        characters</link>, as part of a <link	        linkend="regexref">regular expression</link>, a	        <quote>dot</quote> matches a single character.</para>	    </formalpara>	    </listitem>	</varlistentry>	<varlistentry>	  <term><token>"</token></term>	  <listitem><formalpara><title><link linkend="dblquo">partial	    quoting</link> [double quote]</title>	      <para><emphasis>"STRING"</emphasis> preserves (from	      interpretation) most of the special characters within	      <emphasis>STRING</emphasis>. See also <xref	      linkend="quoting">.</para>	    </formalpara> </listitem>	</varlistentry>	<varlistentry>	  <term><token>'</token></term>	  <listitem><formalpara><title><link linkend="snglquo">full	    quoting</link> [single quote]</title>	      <para><emphasis>'STRING'</emphasis> preserves all special	      characters within <emphasis>STRING</emphasis>. This is a	      stronger form of quoting than using <token>"</token>.	      See also <xref linkend="quoting">.</para>	    </formalpara> </listitem>	</varlistentry>	<varlistentry>	  <term><token>,</token></term>	  <listitem><formalpara><title><link linkend="commaop">comma	    operator</link></title>	      <para>The <command>comma operator</command> links together a	        series of arithmetic operations. All are evaluated, but only		the last one is returned.               <programlisting>let "t2 = ((a = 9, 15 / 3))"  # Set "a = 9" and "t2 = 15 / 3"</programlisting>	      </para> 	    </formalpara> </listitem>	</varlistentry>	<varlistentry>	  <term><token>\</token></term>	  <listitem><formalpara><title><link linkend="escp">escape</link> [backslash]</title>	      <para>A quoting mechanism for single characters.</para>	    </formalpara>	      	      <para><userinput>\X</userinput>		<quote>escapes</quote> the character		<emphasis>X</emphasis>. This has the effect of		<quote>quoting</quote> <emphasis>X</emphasis>, equivalent		to <emphasis>'X'</emphasis>.  The <token>\</token> may		be used to quote <token>"</token> and <token>'</token>,		so they are expressed literally.</para>	      <para>See <xref linkend="quoting"> for an in-depth explanation	        of escaped characters.</para>	    </listitem>	</varlistentry>	<varlistentry>	  <term><token>/</token></term>	  <listitem><formalpara><title>Filename path separator [forward slash]</title>	      <para>Separates the components of a filename (as in	        <filename>/home/bozo/projects/Makefile</filename>).</para>	    </formalpara>	    <para>This is also the division <link	      linkend="arops1">arithmetic operator</link>.</para>	    </listitem>	</varlistentry>	<varlistentry>	  <term><token>`</token></term>	  <listitem><formalpara><title><link	  linkend="commandsubref">command substitution</link></title>	      <para>The <command>`command`</command> construct makes		available the output of <command>command</command>		for assignment to a variable. This is also known as		<link linkend="backquotesref">backquotes</link> or		backticks.</para></formalpara> </listitem>	</varlistentry>	<varlistentry><term><token>:</token></term>	  <indexterm>	    <primary>:</primary>	  </indexterm>	  <indexterm>	    <primary>special character</primary>	    <secondary>:</secondary>	  </indexterm>	  <indexterm>	    <primary>null command</primary>	  </indexterm>	  	  <indexterm>	    <primary>true</primary>	  </indexterm>	  	  <indexterm>	    <primary>endless loop</primary>	  </indexterm>	  	  <listitem>	    <para><anchor id="nullref"></para>	    <formalpara><title>null command [colon]</title>	      <para>This is the shell equivalent of a		<quote>NOP</quote> (<replaceable>no op</replaceable>, a		do-nothing operation). It may be considered a synonym for		the shell builtin <link linkend="trueref">true</link>. The		<quote><token>:</token></quote> command is itself a		Bash <link linkend="builtinref">builtin</link>, and its		<link linkend="exitstatusref">exit status</link> is		<quote>true</quote> (<returnvalue>0</returnvalue>).</para>	    </formalpara>	    <para><programlisting>:echo $?   # 0</programlisting></para>	    <para>Endless loop:</para>	    <para><programlisting>while :do   operation-1   operation-2   ...   operation-ndone# Same as:#    while true#    do#      ...#    done</programlisting>	    </para>	    <para>Placeholder in if/then test:</para>	    <para><programlisting>if conditionthen :   # Do nothing and branch aheadelse   take-some-actionfi</programlisting>	    </para>	    <para>Provide a placeholder where a binary operation is	      expected, see <xref linkend="arithops"> and <link	      linkend="defparam">default parameters</link>.</para>	    <para><programlisting>: ${username=`whoami`}# ${username=`whoami`}   Gives an error without the leading :#                        unless "username" is a command or builtin...</programlisting></para>	    <para>Provide a placeholder where a command is expected in a	      <link linkend="heredocref">here document</link>. See <xref	      linkend="anonheredoc">.</para>	    <para>Evaluate string of variables using		<link linkend="paramsubref">parameter substitution</link>		(as in <xref linkend="ex6">).	    <programlisting>: ${HOSTNAME?} ${USER?} ${MAIL?}#  Prints error message#+ if one or more of essential environmental variables not set.</programlisting></para>                        <para><command><link linkend="exprepl1">Variable expansion / substring	      replacement</link></command>.</para>	    	    <para>In combination with the <token>&gt;</token> <link	      linkend="ioredirref">redirection operator</link>,	      truncates a file to zero length, without changing its	      permissions. If the file did not previously exist,	      creates it.	      <programlisting>: > data.xxx   # File "data.xxx" now empty.	      # Same effect as   cat /dev/null >data.xxx# However, this does not fork a new process, since ":" is a builtin.</programlisting>              See also <xref linkend="ex12">.</para>	    <para>In combination with the <token>&gt;&gt;</token>	      redirection operator, has no effect on a pre-existing	      target file (<userinput>: &gt;&gt; target_file</userinput>).	      If the file did not previously exist, creates it.</para>	    <note><para>This applies to regular files, not pipes,	      symlinks, and certain special files.</para></note>	    <para>May be used to begin a comment line, although this is not	      recommended. Using <token>#</token> for a comment turns	      off error checking for the remainder of that line, so	      almost anything may appear in a comment. However,	      this is not the case with	      <token>:</token>.	      <programlisting>: This is a comment that generates an error, ( if [ $x -eq 3] ).</programlisting>	    </para>	    <para>The <quote><token>:</token></quote> also serves as a field	      separator, in <filename>/etc/passwd</filename>, and in the <link	      linkend="pathref">$PATH</link> variable.	      <screen><prompt>bash$ </prompt><userinput>echo $PATH</userinput><computeroutput>/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/sbin:/usr/sbin:/usr/games</computeroutput></screen>	    </para>	  </listitem>	</varlistentry>	<varlistentry>	  <term><token>!</token></term>	  <indexterm>	    <primary>!</primary>	  </indexterm>	  <indexterm>	    <primary>special character</primary>	    <secondary>!</secondary>	  </indexterm>	  <indexterm>	    <primary>not</primary>	    <secondary>logical</secondary>	  </indexterm>	  	  <indexterm>	    <primary>not</primary>	  </indexterm>	  	  <listitem>	  <para><anchor id="notref"></para>	  <formalpara><title>reverse (or negate) the sense of	  a test or exit status [bang]</title>	      <para>The <token>!</token> operator inverts the <link		linkend="exitstatusref">exit status</link>		of the command to which it is applied (see		<xref linkend="negcond">). It also inverts		the meaning of a test operator. This can, for		example, change the sense of <quote>equal</quote>		( <link linkend="equalsignref">=</link>		) to <quote>not-equal</quote> ( != ). The		<token>!</token> operator is a Bash <link		linkend="keywordref">keyword</link>.</para>	    </formalpara>	      <para>In a different context, the <token>!</token>	        also appears in <link linkend="ivrref">indirect variable		references</link>.</para>	      <para>In yet another context, from the <emphasis>command		line</emphasis>, the <token>!</token> invokes the		Bash <emphasis>history mechanism</emphasis> (see <xref		linkend="histcommands">). Note that within a script,		the history mechanism is disabled.</para>	  </listitem>	</varlistentry>	<varlistentry>	  <term><token>*</token></term>	  <indexterm>	    <primary>*</primary>	  </indexterm>	  <indexterm>	    <primary>special character</primary>	    <secondary>*</secondary>	  </indexterm>	  <indexterm>	    <primary>wild card</primary>	    <secondary>globbing</secondary>	  </indexterm>	  	  <indexterm>	    <primary>regular expression</primary>	  </indexterm>	  	  <listitem><formalpara><title>wild card [asterisk]</title>	      <para>The <token>*</token> character serves as a <quote>wild	        card</quote> for filename expansion in		<link linkend="globbingref">globbing</link>. By itself,		it matches every filename in a given directory.</para>	    </formalpara>	  <para>	      <screen><prompt>bash$ </prompt><userinput>echo *</userinput><computeroutput>abs-book.sgml add-drive.sh agram.sh alias.sh</computeroutput>	      </screen>	    </para>			      <para>The <token>*</token> also represents any number	      (or zero) characters in a <link		linkend="regexref">regular expression</link>.</para>	  </listitem>	</varlistentry>	<varlistentry>	  <term><token>*</token></term>	  <indexterm>	    <primary>*</primary>	  </indexterm>	  <indexterm>	    <primary>special character</primary>	    <secondary>*</secondary>	  </indexterm>	  <indexterm>	    <primary>multiplication</primary>	    <secondary>exponentiation</secondary>	  </indexterm>	  	  <indexterm>	    <primary>arithmetic operator</primary>	  </indexterm>	  	  <listitem><formalpara><title><link linkend="arops1">arithmetic operator</link></title>	      <para>In the context of arithmetic operations, the	        <token>*</token> denotes multiplication.</para>	    </formalpara>	      <para>A double asterisk, <token>**</token>, is the <link	        linkend="exponentiationref">exponentiation	        operator</link>.</para>	  </listitem>	</varlistentry>	<varlistentry>	  <term><token>?</token></term>	  <indexterm>	    <primary>?</primary>	  </indexterm>	  <indexterm>	    <primary>special character</primary>	    <secondary>?</secondary>	  </indexterm>	  <indexterm>	    <primary>test</primary>	    <secondary>operator</secondary>	  </indexterm>	  	  <indexterm>	    <primary>test token</primary>	  </indexterm>	  	  <listitem><formalpara><title>test operator</title>	      <para>Within certain expressions, the <token>?</token> indicates	        a test for a condition.</para>	    </formalpara>	      <para>In a <link linkend="dblparens">double	        parentheses construct</link>, the <token>?</token> serves		as a C-style trinary operator. See <xref		linkend="cvars">.</para>

⌨️ 快捷键说明

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