Worked example of a subshell

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the bash category.

Last Updated: 2024-11-23

The following piece of code has an effect similar to rsync for copying folders with metadata like permissions. But what's exactly is going on with the combination of brackets and parentheses?

(cd src && tar -c .) | (cd dst && tar -xp)

Analysis of main stuff

You might want to supress an environmental variable temporarily with a subshell bash (unset http_proxy; wget ...)

Aside on the tar command

Resources