Gentoo Archives: gentoo-user

From: Andrew Savchenko <bircoph@×××××.com>
To: gentoo-user@l.g.o
Cc: Randy Barlow <randy@×××××××××××××××××.com>
Subject: Re: [gentoo-user] to nest commands
Date: Tue, 26 Nov 2013 15:13:15
Message-Id: 20131126191240.9876ecf41bea408fab95b9e2@gmail.com
In Reply to: Re: [gentoo-user] to nest commands by Randy Barlow
1 On Tue, 26 Nov 2013 09:58:24 -0500 Randy Barlow wrote:
2 > On Tue, 26 Nov 2013 11:52:10 +0100
3 > Hinnerk van Bruinehsen <h.v.bruinehsen@×××××××××.de> wrote:
4 > > There are some other options of "nesting" as well. You can use
5 > > backticks "`" or $(...) to run a command "inside" another. An example
6 > > would be emerge `qlist -CI x11-drivers` (or the equivalent emerge
7 > > $(qlist -CI x11-drivers) ) . This would run "qlist -CI
8 > > x11-drivers" (lists installed packages of the category x11-drivers)
9 > > and use this output for emerge (which will effectively result in
10 > > reinstalling every package from the x11-drivers category).
11 >
12 > As I understand it, the $(...) syntax is the preferred way of nesting,
13 > as opposed to backticks. I think this may be due to backticks requiring
14 > some special escaping that the $(...) syntax does not require. I
15 > attempted a brief search for supporting information, but didn't find a
16 > definitive source to back up my claims :)
17
18 The reason for $(...) being preferred is simple: you can nest
19 $($($(...))), but you can't nest `...`. Deep nesting is quite useful
20 indeed.
21
22 Best regards,
23 Andrew Savchenko

Replies

Subject Author
Re: [gentoo-user] to nest commands Neil Bothwick <neil@××××××××××.uk>