Subshells
( ) runs commands in a child shell. Changes inside do not affect the parent.
Example
x=1
( x=2; echo "inner $x" )
echo "outer $x"
(cd /tmp && pwd)
pwd >/dev/nullResult
inner 2 outer 1 /tmp
Exercise
Group in a subshell.
x=2 )Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.