开发者

Better quote to execute command on shell script

I'm in doubt of the diference and which one is the better quot开发者_如何学Goe to execute a command in shell script.

For example, I have this two examples:

echo "The name of the computer is `uname -n`"
echo "The name of the computer is $(uname -n)"

Which one is better? Or there is no diference?


The $(...) one is generally recommended because it nests easier. Compare:

date -d "1970-01-01 $(echo "$(date +%s)-3600"|bc) sec UTC"

date -d "1970-01-01 `echo \"\`date +%s\`-3600\"|bc` sec UTC "
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜