What's the difference bewteen ( ) and { } when coding in Bash ?
When should I use one or the other ?
Asked
Active
Viewed 148 times
-1
Dreamer
- 112
- 1
- 14
Antoine Orsoni
- 141
- 4
1 Answers
4
Braces do not start a subshell; parentheses do.
$ x=3
$ { x=4; }; echo "$x"
4
$ ( x=5 ); echo "$x"
4
Usually, unless you specifically need to localize a parameter assignment, you can use {}.
chepner
- 497,756
- 71
- 530
- 681