Horje
$() vs () bash Code Example
$() vs `` bash
$() or `` is called command subsitution

They are the same. Command subsitution allows the output of a command to 
replace the command identifier.
() vs {} bash
() 
- Placing a list of commands between parentheses causes a subshell environment
to be created, and each of the commands in list to be executed in that subshell.
Since the list is executed in a subshell, variable assignments do not remain 
in effect after the subshell completes.

{}
- Placing a list of commands between curly braces causes the list to be executed
in the current shell context. No subshell is created. The semicolon (or newline)
following list is required.
$() vs () bash
$(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.




Shell

Related
delete all files in a folder linux Code Example delete all files in a folder linux Code Example
how to install lshellchecck in linux Code Example how to install lshellchecck in linux Code Example
vim cut Code Example vim cut Code Example
javascript currencey formatter Code Example javascript currencey formatter Code Example
linux count lines csv files Code Example linux count lines csv files Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9