From: Frank Gruellich <frank@der-frank.org>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] OT: Bash question
Date: Thu, 20 Sep 2007 17:31:25 +0200 [thread overview]
Message-ID: <20070920153125.GB10595@der-frank.org> (raw)
In-Reply-To: <46F23395.7030305@sbcglobal.net>
* Anthony E. Caudel <tony.caudel@sbcglobal.net> 20. Sep 07:
> Is there any way to make "pushd" and "popd" (Bash built-ins) silent?
> [snip] For example:
>
> OLD_VER=$(pushd /boot; ls kernel-* | sort | head -1; popd)
> echo $OLD_VER
> /boot ~ kernel-2.6.22-gentoo-r2 ~
For that exact example... why you bother at all? $( ) opens a subshell
and cd's in subshells don't interact with parent shell so you could
simply write:
OLD_VER=$(cd /boot; ls kernel-* | sort | head -1)
or
OLD_VER=`cd /boot; ls kernel-* | sort | head -1`
if you want to be more compatible. Or am I missing a point?
HTH, kind regards,
Frank.
--
Sigmentation fault
--
gentoo-user@gentoo.org mailing list
next prev parent reply other threads:[~2007-09-20 15:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-20 8:47 [gentoo-user] OT: Bash question Anthony E. Caudel
2007-09-20 9:05 ` Dirk Heinrichs
2007-09-20 15:31 ` Frank Gruellich [this message]
2007-09-21 8:19 ` Anthony E. Caudel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070920153125.GB10595@der-frank.org \
--to=frank@der-frank.org \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox