Re: Back to last driectory

From: Michael Heiming (michael+USENET_at_www.heiming.de)
Date: 11/13/05


Date: Sun, 13 Nov 2005 17:46:14 +0100

In comp.unix.shell Thorsten Kampe <thorsten@thorstenkampe.de>:
> * Michael Heiming (2005-11-12 23:16 +0100)
>> In comp.unix.shell base60 <nobody@whitehouse.com>:
>>> Thorsten Kampe wrote:
>>>> * base60 (2005-11-12 16:38 +0100)

[ change directory to previous ]

>>>> Welcome to the twentyfirst century. A directory stack (for pushd/popd)
>>>> already exists - at least in bash and zsh. And "cd" accepts numbers
>>>> ("cd +2"/"cd -2"/cd "~2").
       ^^^^^ ^^^^^

>> In addition it doesn't work on my box (Linux) with bash 2.05,
>> bash 3.00, zsh or ksh.

> It should:

Not the announced options:

$ cd -2
bash: cd: -2: invalid option
cd: usage: cd [-L|-P] [dir]

> cafeuser@CHILLOUT28% bash --norc --noprofile
> $ pushd /cygdrive/c
> /cygdrive/c ~
> $ pushd /cygdrive/e
> /cygdrive/e /cygdrive/c ~
> $ cd ~1
> $ pwd
> /cygdrive/c
> $ cd ~+2
> $ pwd
> /home/thorsten

Ah see, following your example it does at least something. But it
doesn't make me feel as if I should use it, YMMV.

-- 
Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94)
mail: echo zvpunry@urvzvat.qr | perl -pe 'y/a-z/n-za-m/'
#bofh excuse 112: The monitor is plugged into the serial port


Relevant Pages

  • Re: question about soft links
    ... Modern shells such as bash and ksh have a PWD envirnment variable which is ... cd `pwd -P` # forces the builtin pwd to use the real working directory ...
    (comp.unix.misc)
  • Re: [Way OT] "#!/bin/bash" changes working directory
    ... > Besides, the snippet is procuding the desired result here ($pwd, not ... bash doesn't read any startup files when called as ... > script interpreter in this fashion, so I've got no idea why your bash ...
    (Debian-User)
  • Re: Bulk Rename Date Format
    ... Thanks for some examples of substring extraction, ... See man bash chapter "Parameter Expansion"... ... Other day I was trying to extract '2.4' or '2.6' from script caller's ... PWD, gave up and read it from the expected Makefile in $PWD instead:) ...
    (comp.unix.shell)
  • Re: ant change directory command
    ... believe that bash is telling you it couldn't find a file called ... [foo]$ pwd ... In order for it to be possible to change directories in your Ant ...
    (comp.lang.java.programmer)
  • Re: Q. How do I get bash to respect my physical directory structure?
    ... I.e., bash sees the ".." ... if I us the symlink '/home/js/pictures' I end up in the same ... Hitting tab with 'cd ..' ...
    (comp.unix.shell)