O'Reilly logo
  • Miguel Fernandez thinks this is interesting:

The results are different using a process list. The list is executed with echo $BASH_SUBSHELL tacked onto the end:

$ (pwd ; ls ; cd /etc ; pwd ; cd ; pwd ; ls ; echo $BASH_SUBSHELL)
/home/Christine
Desktop    Downloads  Music     Public     Videos
Documents  junk.dat   Pictures  Templates
/etc
/home/Christine
Desktop    Downloads  Music     Public     Videos
Documents  junk.dat   Pictures  Templates
1

In this case, the number one (1) displayed at the output's end. This indicates a subshell was indeed created and used for executing these commands.

From

Cover of Linux Command Line and Shell Scripting Bible, 3rd Edition

Note

bash subshell created by using parens