Gentoo Archives: gentoo-user

From: Frank Gruellich <frank@×××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] OT: Bash question
Date: Thu, 20 Sep 2007 15:47:13
Message-Id: 20070920153125.GB10595@der-frank.org
In Reply to: [gentoo-user] OT: Bash question by "Anthony E. Caudel"
1 * Anthony E. Caudel <tony.caudel@×××××××××.net> 20. Sep 07:
2 > Is there any way to make "pushd" and "popd" (Bash built-ins) silent?
3 > [snip] For example:
4 >
5 > OLD_VER=$(pushd /boot; ls kernel-* | sort | head -1; popd)
6 > echo $OLD_VER
7 > /boot ~ kernel-2.6.22-gentoo-r2 ~
8
9 For that exact example... why you bother at all? $( ) opens a subshell
10 and cd's in subshells don't interact with parent shell so you could
11 simply write:
12
13 OLD_VER=$(cd /boot; ls kernel-* | sort | head -1)
14
15 or
16
17 OLD_VER=`cd /boot; ls kernel-* | sort | head -1`
18
19 if you want to be more compatible. Or am I missing a point?
20
21 HTH, kind regards,
22 Frank.
23 --
24 Sigmentation fault
25 --
26 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] OT: Bash question "Anthony E. Caudel" <tony.caudel@×××××××××.net>