7.4. Nested if/then Condition Tests 7.5. Testing Your Knowledge of Tests

7.4. Nested if/then Condition Tests

嵌套条件测试相当于复合条件测试中的 &&

7.5. Testing Your Knowledge of Tests


  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

有2个问题:

1、在测试条件中多个测试条件(如上:-f -a -f)的组合规则和形式是怎么样的?

2、"netscape /usr/share/doc/HTML/index.html &"后面加一个&是什么意思?

另外,这章布置了习题,分析/etc/X11/xinit/xinitrc文件中的条件语句,这遍就略过习题了。下同。

英语疑问:

1、excerpt

This file contains quite a number of if/then tests, as the following excerpt shows.

2、failsafe, fallbacks

 # failsafe settings.  Although we should never get here

 # (we provide fallbacks in Xclients as well) it can't hurt.

One thought on “7.4. Nested if/then Condition Tests 7.5. Testing Your Knowledge of Tests”


  1. 2、"netscape /usr/share/doc/HTML/index.html &"后面加一个&是什么意思

    加&是后台执行的意思。

    如教程中说:

    abs-guide-3.7/HTML/special-chars.html


    &

        Run job in background. A command followed by an & will run in the

        background.

         bash$ sleep 10 &

         [1] 850

         [1]+  Done                    sleep 10

        Within a script, commands and even loops may run in the background.

Comments are closed.