From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14709 invoked from network); 15 Jan 2002 10:53:36 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 15 Jan 2002 10:53:36 -0000 Received: (qmail 29337 invoked by alias); 15 Jan 2002 10:53:06 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 4591 Received: (qmail 29326 invoked from network); 15 Jan 2002 10:53:05 -0000 X-Authentication-Warning: erdbeere.lifebits.local: luthien set sender to d.vogt@lifebits.de using -f Date: Tue, 15 Jan 2002 11:53:02 +0100 From: Dominik Vogt To: zsh-users@sunsite.dk Subject: Re: problem with named directories over the net Message-ID: <20020115115302.B660@lifebits.de> Reply-To: d.vogt@lifebits.de Mail-Followup-To: zsh-users@sunsite.dk References: <20020111134158.F852@lifebits.de> <27644.1011014849@dis.strath.ac.uk> <20020114174039.F633@lifebits.de> <1020114181132.ZM18591@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.12i In-Reply-To: <1020114181132.ZM18591@candle.brasslantern.com>; from schaefer@brasslantern.com on Mon, Jan 14, 2002 at 06:11:32PM +0000 X-Virus-Scanned: by AMaViS perl-11 X-Sender: 520008918237-0001@t-dialin.net On Mon, Jan 14, 2002 at 06:11:32PM +0000, Bart Schaefer wrote: > On Jan 14, 5:40pm, Dominik Vogt wrote: > } Subject: Re: problem with named directories over the net > } > } Works like a charm - with a few minor modifications. First, you > } can put that in the chpwd function to have the code executed only > } when the working directory changes. > > I had been about to suggest that myself, but if you ever happen to > 'setopt chaselinks' you could end up with an infinite loop on your > hands, so I didn't. In fact I got that loop at some point when writing the function and switched to precmd so that I don't have to think about it. > Also, if it's in chpwd it won't get executed > the first time a new shell starts up, which might make a difference > in a few rare cases. > > Of course you can insert a call to chpwd at the end of your .zshrc, That's how I've been doing it for ages to set the xterm title. > and if > you use the zsh/parameter module you could prevent the infinite loop with: Nope, I'm still using the zsh that came with SuSE 7.1 at work (3.1.9). > > chpwd () > { > [[ $funcstack == chpwd*chpwd* ]] && return > # ... etc. ... > } > > } Second, the slash before the > } asterisk in the case value prevents that it works on the top > } directory itself since PWD does not have the trailing slash for > } directories. I now use this script: > } > } chpwd () > } { > } case "$PWD" in > } /net/server/share/home*) > } cd '/net/server/share' '' > } ;; > } /net/server/share/common*) > } cd '/net/server/share' '' > } ;; > } *) > } ;; > } esac > } } > > Is it really the case that only `home' and `common' are automounted? > Anyway, having an empty *) fallthrough is redundant. Why not just: > > chpwd () > { > [[ $PWD == /net/server/share/* ]] && cd /net/server/share '' > } > > (plus possible loop protection per above)? I can't use this approach because there are some directories on the share that are not remapped to /. Some are mapped to named directories that not necessarily have the same name (obviously, I can't give the tmp directory on the share the name 'tmp'). Bye Dominik ^_^ ^_^ -- Dominik Vogt, email: d.vogt@lifebits.de LifeBits Aktiengesellschaft, Albrechtstr. 9, D-72072 Tuebingen fon: ++49 (0) 7071/7965-0, fax: ++49 (0) 7071/7965-20