What is the difference between backticks and $() i

2019-03-11 13:37发布

This question already has an answer here:

I see in bash scripts two different forms which seems to do the same:

`some command`

and

$(some command)

What is the difference between the two, and when should I use each one of them?

1条回答
2楼-- · 2019-03-11 14:14

There is no semantic difference. The backtick syntax is the older and less powerful version. See man bash, Section "Command Substitution".

If your shell supports the $() syntax, prefer it because it can be nested.

查看更多
登录 后发表回答