Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • (unset ENV_VAR; exec somecommand) if you want to be equivalent to the original in efficiency (by consuming the subshell). As it is, this adds an extra fork. Commented Aug 28, 2017 at 17:12
  • 1
    @Charles indeed, although some shells do that automatically since command is the last command in the subshell invocation. Commented Aug 28, 2017 at 19:01
  • +1 because this way is simple to type for interactive use. I use subshells for one-off changes to the shell environment for a one-liner instead of remembering that it's env -u. Commented Aug 29, 2017 at 0:37