Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: some directory changing tools to share
- X-seq: zsh-users 2958
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: Oliver Kiddle <opk@xxxxxxxxxxxxx>
- Subject: Re: some directory changing tools to share
- Date: Tue, 7 Mar 2000 17:46:28 +0000
- Cc: Zsh users <zsh-users@xxxxxxxxxxxxxx>
- In-reply-to: <38C4E2BE.AF06B2F7@xxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <200003062114.PAA01448@xxxxxxxxxxxxxxxxxxxxx> <38C4E2BE.AF06B2F7@xxxxxxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author