Table of Contents

Grouping commands in a subshell

Synopsis

( <LIST> )

Description

The list <LIST> is executed in a separate shell - a subprocess. No changes to the environment (variables etc…) are reflected in the "main shell".

Examples

Execute a command in a different directory.

echo "$PWD"
( cd /usr; echo "$PWD" )
echo "$PWD" # Still in the original directory.

Portability considerations

(((1+1))) # Equivalent to: (( (1+1) ))

See also