[TUHS] Use of "{}" in the Shell?

Chet Ramey via TUHS tuhs at tuhs.org
Thu Aug 6 00:02:08 AEST 2026


On 8/5/26 8:26 AM, Arnold Robbins via TUHS wrote:

> Using () instead of {} makes
> a difference for something like the classic tar pipeline:
> 
> 	(cd /home ; tar -cf - arnold) | (cd /newhome ; tar -xpvf -)
> 
> to copy a file tree from one place to another.
> 
> The `cd's happen in subshells, leaving the parent shell in the
> original directory.

Sure, let's dive down the rabbit hole. The () vs. {} doesn't make a
difference here: except for ksh (and I think maybe zsh?), all elements
of a pipeline are executed in subshells.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet at case.edu    http://tiswww.cwru.edu/~chet/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: OpenPGP digital signature
URL: <http://www.tuhs.org/pipermail/tuhs/attachments/20260805/db8d5af4/attachment.sig>


More information about the TUHS mailing list