- 通过shell下简单的验证发现:
[root@localhost mem_test]# a=xx
[root@localhost mem_test]# (c=b;echo $a$c)
xxb
[root@localhost mem_test]# echo $a
xx
[root@localhost mem_test]# echo $ab
[root@localhost mem_test]# echo "$a"b
xxb
[root@localhost mem_test]# echo "$a"b
xxb
[root@localhost mem_test]# echo ${a}b
xxb
[root@localhost mem_test]# echo "${a}"b
xxb
[root@localhost mem_test]# echo '${a}'b
${a}b
shell下如何连接两个变量如上:
c=b;echo $a$c
同时设置变量echo "$a"b
双引号加字母echo ${a}b
大括号加字母echo "${a}"b
双引号加大括号加zimu- echo '${a}'b 这种方法是无效的