# 50 subshells whose body can change nothing outside, then two more. # cd saves/restores the cwd so it too can run in-process. # The counters tell them apart from a real fork. i=0 while [ $i -lt 50 ]; do ( true ) i=$((i + 1)) done ( echo a ) ( cd /tmp ) echo done