Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 6
    Ah. Now to find all the places, where my predecessor used the wrong braces. Thanks for the insight. Commented Dec 10, 2014 at 13:43
  • 15
    Take careful note of the spacing in the man page: { and } are not syntax, they are reserved words and must be surrounded by spaces, and the list must end with a command terminator (semicolon, newline, ampersand) Commented Dec 10, 2014 at 16:18
  • Out of interest, does this tend to actually be another process or just a separate environment in an internal stack? I use () a lot for isolating chdirs, and must have been lucky with my use of $$ etc if the former. Commented Dec 11, 2014 at 0:14
  • 5
    @DanSheppard It is another process, but (echo $$) prints parent shell id because $$ is expanded even before subshell is created. In fact printing subshell process id could be tricky, see stackoverflow.com/questions/9119885/… Commented Dec 11, 2014 at 0:25
  • @jimmij, How can it be that $$ is expanded before the subshell is created, and yet $BASHPID shows the correct value for a subshell? Commented Sep 10, 2016 at 2:17