From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3428 invoked from network); 14 Jan 2002 18:11:55 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 14 Jan 2002 18:11:55 -0000 Received: (qmail 8971 invoked by alias); 14 Jan 2002 18:11:37 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 4590 Received: (qmail 8958 invoked from network); 14 Jan 2002 18:11:36 -0000 From: "Bart Schaefer" Message-Id: <1020114181132.ZM18591@candle.brasslantern.com> Date: Mon, 14 Jan 2002 18:11:32 +0000 In-Reply-To: <20020114174039.F633@lifebits.de> Comments: In reply to Dominik Vogt "Re: problem with named directories over the net" (Jan 14, 5:40pm) References: <20020111134158.F852@lifebits.de> <27644.1011014849@dis.strath.ac.uk> <20020114174039.F633@lifebits.de> X-Mailer: Z-Mail (5.0.0 30July97) To: d.vogt@lifebits.de, zsh-users@sunsite.dk Subject: Re: problem with named directories over the net MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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. 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, and if you use the zsh/parameter module you could prevent the infinite loop with: 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)? -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net