今天不小心被引号给折腾了一下,然后就......
关于''和" ",手头有一本书称为强引用和弱引用,在网上搜了一下有一篇“Shell十三问”中这样写:
* hard quote:' ' (单引号),凡在 hard quote 中的所有 meta 均被关闭。
* soft quote:" " (双引号),在 soft quote 中大部份 meta 都会被关闭,但某些则保留(如 $ )。
看到一个例子,清晰了......
#cat variables.sh
#! /bin/bash # variables.sh fruit=apple count=5 echo 'We have $count ${fruit}(s)' echo "We have $count ${fruit}(s)"
./variables.sh
We have $count ${fruit}(s)
We have 5 apple(s)
转载于:https://blog.51cto.com/jiumiao/1257623