1. Shell Something Out

1.1 单引号和双引号的区别、"="前后有空格区别

1001.sh文件内容:

#! /bin/bash#x = 20;x=20# 单引号的用变量x: hello $x worldecho '单引号的用变量x: hello $x world'# 没引号的变量x: hello 20 worldecho 没引号的变量x: hello $x world# 双引号的变量x: hello 20 world echo "双引号的变量x: hello $x world"
  • 等号前后有空格,不一样: 第3行的内容是: 20赋值给变量x; 第2行就不是了(它是相等运算), 留神!
  • 单引号中的"$变量"会当做字符串原样输入, 不会计算变量; 双引号会!没引号也会!

2. Have a Good Command

3. File In, File Out

4. Texting and Driving

5. Tangled Web? Not At All!

6. The backup Plan

7. The Old-boy Network

8. Put on the Monitor's Cap

9. Administration Calls