{ list; }
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.
In addition to the creation of a subshell, there is a subtle difference between these two constructs due to historical reasons. The braces are reserved words, so they must be separated from the list by blanks or other shell metacharacters. The parentheses are operators, and are recognized as separate tokens by the shell even if they are not separated from the list by whitespace.
The exit status of both of these constructs is the exit status of list.
3.2.5 Coprocesses
A coprocess is a shell command preceded by the coproc reserved word. A coprocess is executed asynchronously in a subshell, as if the command had been terminated with the
‘&’ control operator, with a two-way pipe established between the executing shell and the coprocess.
The format for a coprocess is: coproc [NAME] command [redirections]
This creates a coprocess named NAME. If NAME is not supplied, the default name is
COPROC. NAME must not be supplied if command is a simple command (see Section 3.2.1
[Simple Commands], page 8); otherwise, it is interpreted as the first word of the simple command.
When the coprocess is executed, the shell creates an array variable (see Section 6.7
[Arrays], page 89) named NAME in the context of the executing shell. The standard output of command is connected via a pipe to a file descriptor in the executing shell, and that file descriptor is assigned to NAME[0]. The standard input of command is connected via a pipe to a file descriptor in the executing shell, and that file descriptor is assigned to NAME[1].
This pipe is established before any redirections specified by the command (see Section 3.6
[Redirections], page 31). The file descriptors can be utilized as arguments to shell commands and redirections using standard word expansions. The file descriptors are not available in subshells.
The process ID of the shell spawned to execute the coprocess is available as the value of the variable NAME PID. The wait builtin command may be used to wait for the coprocess to terminate.
Since the coprocess is created as an asynchronous command, the coproc command always returns success. The return status of a coprocess is the exit status of command.
3.2.6 GNU Parallel
There are ways to run commands in parallel that are not built into Bash. GNU Parallel is a tool to do just that.
GNU Parallel, as its name suggests, can be used to build and run commands in parallel.
You may run the same command with different arguments, whether they are filenames, usernames, hostnames, or lines read from files. GNU Parallel provides shorthand references to many of the most common operations (input lines, various portions of the input line,