Subshells are generated whenever you enclose commands in ()'s, perform command substitution, for background processes, and for co-processes (discussed later in Chapter 8). A subshell is a separate copy of the parent shell, so variables, functions, and aliases from the parent shell are available to the subshell. However, subshells cannot change the value of parent shell variables, functions, or aliases. So if we set LOCALVAR to a value in the current shell:
$ LOCALVAR="This is the original value"
then check the value in a subshell, we see that it is defined:
$ (print $LOCALVAR) This is the original value
If we set it in the subshell to another value:
$ (LOCALVAR="This is the new value")
then check the value in the parent shell, ...