📄 testtest.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><HTML><HEAD><TITLE>Testing Your Knowledge of Tests</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="Advanced Bash-Scripting Guide"HREF="index.html"><LINKREL="UP"TITLE="Tests"HREF="tests.html"><LINKREL="PREVIOUS"TITLE="Nested if/then Condition Tests"HREF="nestedifthen.html"><LINKREL="NEXT"TITLE="Operations and Related Topics"HREF="operations.html"><METAHTTP-EQUIV="Content-Style-Type"CONTENT="text/css"><LINKREL="stylesheet"HREF="common/kde-common.css"TYPE="text/css"><METAHTTP-EQUIV="Content-Type"CONTENT="text/html; charset=iso-8859-1"><METAHTTP-EQUIV="Content-Language"CONTENT="en"><LINKREL="stylesheet"HREF="common/kde-localised.css"TYPE="text/css"TITLE="KDE-English"><LINKREL="stylesheet"HREF="common/kde-default.css"TYPE="text/css"TITLE="KDE-Default"></HEAD><BODYCLASS="SECT1"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#AA0000"VLINK="#AA0055"ALINK="#AA0000"STYLE="font-family: sans-serif;"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">Advanced Bash-Scripting Guide: An in-depth exploration of the art of shell scripting</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="nestedifthen.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 7. Tests</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="operations.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="TESTTEST"></A>7.5. Testing Your Knowledge of Tests</H1><P>The systemwide <TTCLASS="FILENAME">xinitrc</TT> file can be used to launch the X server. This file contains quite a number of <ICLASS="FIRSTTERM">if/then</I> tests. The following is excerpted from an <SPANCLASS="QUOTE">"ancient"</SPAN> version of <TTCLASS="FILENAME">xinitrc</TT> (<ICLASS="FIRSTTERM">Red Hat 7.1</I>, or thereabouts).</P><P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING"> 1 if [ -f $HOME/.Xclients ]; then 2 exec $HOME/.Xclients 3 elif [ -f /etc/X11/xinit/Xclients ]; then 4 exec /etc/X11/xinit/Xclients 5 else 6 # failsafe settings. Although we should never get here 7 # (we provide fallbacks in Xclients as well) it can't hurt. 8 xclock -geometry 100x100-5+5 & 9 xterm -geometry 80x50-50+150 & 10 if [ -f /usr/bin/netscape -a -f /usr/share/doc/HTML/index.html ]; then 11 netscape /usr/share/doc/HTML/index.html & 12 fi 13 fi</PRE></TD></TR></TABLE></P><P>Explain the <ICLASS="FIRSTTERM">test</I> constructs in the above snippet, then examine an updated version of the file, <TTCLASS="FILENAME">/etc/X11/xinit/xinitrc</TT>, and analyze the <ICLASS="FIRSTTERM">if/then</I> test constructs there. You may need to refer ahead to the discussions of <AHREF="textproc.html#GREPREF">grep</A>, <AHREF="sedawk.html#SEDREF">sed</A>, and <AHREF="regexp.html#REGEXREF">regular expressions</A>.</P></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="nestedifthen.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="index.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="operations.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Nested <ICLASS="FIRSTTERM">if/then</I> Condition Tests</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="tests.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Operations and Related Topics</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -