最佳答案
在bash
中有两种方法来捕获命令行的输出:
Legacy Bourne shell backticks ``
:
var=`command`
$()
syntax (which as far as I know is Bash specific, or at least not supported by non-POSIX old shells like original Bourne)
var=$(command)
Is there any benefit to using the second syntax compared to backticks? Or are the two fully 100% equivalent?