Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

() 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.
 
PREVIOUS NEXT
Tagged: #bash
ADD COMMENT
Topic
Name
7+1 =