- 拼接字符串, 在定义好变量之后, 输出时候的拼接, 注意无意输出一些空格 。
比如:
#!/bin/bash a1="China" a2="${a1}, Japan and Korean are the three important countries in east asia. \n" a3="Which country do you like the most if you have one chance to travel?" echo -e $a2$a3 #如果a2到$a3之间插入了空格,那么echo会原样输出空格
#此外,如果想让"\n"输出,而不是输出字符,那么在echo 后面要加-e
- String定义后,索引的下标和C一样是从0开始的。