Published on

Subshells vs grouping

Authors
  • Mehdi Akiki avatar
    Name
    Mehdi Akiki
    Twitter
(cd /tmp; ls)    # runs in subshell, cwd unchanged
{ cd /tmp; ls; } # runs in current shell

Tip: variable changes in subshells do not affect the parent shell.

I build and scale reliable production systems. Open to full-time and freelance work with U.S.-based teams that value ownership and execution.

Got something in mind?

Book a Discovery Call