📜  $() vs () bash - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:49:37.044000             🧑  作者: Mango

代码示例3
$(cmd) substitutes the result of cmd as a string, whereas (cmd; cmd) run a list of commands in a subprocess.

If you want to put the output of one or more commands into a variable use the $( cmd ) form.

However if you want to run a number of commands and treat them as a single unit use the () form.

The latter is useful when you want to run a set of commands in the background.