From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 951 invoked from network); 7 Mar 2000 17:49:07 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 7 Mar 2000 17:49:07 -0000 Received: (qmail 722 invoked by alias); 7 Mar 2000 17:47:18 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2958 Received: (qmail 707 invoked from network); 7 Mar 2000 17:47:16 -0000 From: "Bart Schaefer" Message-Id: <1000307174628.ZM5401@candle.brasslantern.com> Date: Tue, 7 Mar 2000 17:46:28 +0000 In-Reply-To: <38C4E2BE.AF06B2F7@u.genie.co.uk> Comments: In reply to Oliver Kiddle "Re: some directory changing tools to share" (Mar 7, 11:06am) References: <200003062114.PAA01448@w-kwong.ih.lucent.com> <38C4E2BE.AF06B2F7@u.genie.co.uk> X-Mailer: Z-Mail (5.0.0 30July97) To: Oliver Kiddle Subject: Re: some directory changing tools to share Cc: Zsh users MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Mar 7, 11:06am, Oliver Kiddle wrote: } Subject: Re: some directory changing tools to share } } This reminds me of a useful feature of 4DOS (a shareware command.com } replacement which I used to use) and I think also for shared drives in } Netware. It allowed series of dots to refer to parent directories beyond } the parent. So, ... refers to the parent of the parent, .... to the } parent of that etc. How about this? preexec() { setopt localoptions extendedglob if [[ -o autocd && $1 = ...# ]] then eval function $1 \{ cd ..${${1#..}:gs@.@/..}\; unfunction $1 \} alias -g $1="..${${1#..}:gs@.@/..}" fi } Works sort of like named dirs; once you type "....." as a command, it cd's you there and thereafter refers everywhere to "../../../..". For any number of dots greater than 2. Not quite globbing. } Would it be possible to add an option which extends the zsh filename } generation to expand ... to ../.., .... to ../../.. etc. Would this } conflict with any of the existing globbing system? It probably wouldn't conflict with file globbing, but as the globbing system is used for pattern matching in `case' and [[ ]] expressions, I'd be leery of introducing (a) directory-hierarchy-specific expansion and (b) yet another metacharacter, which is in effect what `.' would become. Perhaps (#...) or something like that. By the way, in 3.0.7 this works: zagzig% setopt extendedglob zagzig% cd /usr/src/local/zsh/zsh-3.1.6 zagzig% echo (../)# ../ ../../ ../../../ ../../../../ ../../../../../ But in 3.1.6 it crashes the shell: zagzig% setopt extendedglob zagzig% cd /usr/src/local/zsh/zsh-3.1.6 zagzig% echo (../)# BUG: statfullpath(): pathname too long zsh: segmentation fault (core dumped) $ZSH_NAME -f -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com