Re: [gentoo-user] OT: Bash question

2007-09-21 Thread Anthony E. Caudel
Frank Gruellich wrote:
 * Anthony E. Caudel [EMAIL PROTECTED] 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.
   
Thanks, Frank.  That is the best solution.

Tony

-- 
Those who would give up essential Liberty, to purchase a little temporary 
Safety, deserve neither Liberty nor Safety.
   -- Benjamin Franklin

-- 
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] OT: Bash question

2007-09-20 Thread Dirk Heinrichs
Am Donnerstag, 20. September 2007 schrieb ext Anthony E. Caudel:
 Is there any way to make pushd and popd (Bash built-ins) silent?  As
 it is, when the execute, the directory is echoed to the output, making
 it difficult to use the commands in a script.  For example:

You know you can always redirect output to wherever you want, even 
to /dev/null?

HTH...

Dirk
-- 
Dirk Heinrichs  | Tel:  +49 (0)162 234 3408
Configuration Manager   | Fax:  +49 (0)211 47068 111
Capgemini Deutschland   | Mail: [EMAIL PROTECTED]
Wanheimerstraße 68  | Web:  http://www.capgemini.com
D-40468 Düsseldorf  | ICQ#: 110037733
GPG Public Key C2E467BB | Keyserver: www.keyserver.net


signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-user] OT: Bash question

2007-09-20 Thread Frank Gruellich
* Anthony E. Caudel [EMAIL PROTECTED] 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
-- 
[EMAIL PROTECTED] mailing list