一、内容
1. $(command)是用于存放命令运行结果,等同于`command`,例如:
$ echo $(date)
Thu Jul 2 16:33:11 SGT 2015
$ echo ${date}
2. ${var}是用于引用变量的符号,但在连接其他字符串时需注意"var"的区别,例如:
$ animal=cat
$ echo $animals
# No such variable as “animals”.
$ echo ${animal}s
cats
$ echo "$animals"s
cats
$ echo $animal_food
# No such variable as “animal_food”.
$ echo "$animals"_food
cat_food
$ echo ${animal}_food
cat_food
二、参考引用
http://superuser.com/questions/935374/difference-between-and-in-shell-script
网友评论