Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [zsh] dirstack history: loving zsh, crashing zsh...
- X-seq: zsh-users 9997
- From: Francisco Borges <f.borges@xxxxxx>
- To: Zsh User <zsh-users@xxxxxxxxxx>
- Subject: Re: [zsh] dirstack history: loving zsh, crashing zsh...
- Date: Mon, 6 Mar 2006 19:26:15 +0100
- In-reply-to: <060306085136.ZM4149@xxxxxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: Zsh User <zsh-users@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: Alfa Informatica - Rijksuniversiteit Groningen
- References: <20060302175252.GA31734@xxxxxxxxxx> <060305011947.ZM7258@xxxxxxxxxxxxxxxxxxxxxx> <20060306130139.GA9256@xxxxxxxxxx> <060306085136.ZM4149@xxxxxxxxxxxxxxxxxxxxxx>
» On Mon, Mar 06, 2006 at 08:51AM -0800, Bart Schaefer wrote:
> On Mar 6, 2:01pm, Francisco Borges wrote:
> }
> } it won't stop that accumulation of repeated directories at .zdirs
> } (essentially since "dirs" always include the CWD).
>
> If that's the only issue, then don't use "dirs" at all; instead use
> "print $dirstack" which *won't* include the current directory.
No, I want the CWD, but that may become a problem because
1. "dirs" includes the CWD even if it is in the $dirstack;
2. "dirstack=( $(< ~/.zdirs) )" bypasses pushd_ignore_dups;
3. some popular directories, triggered this "double entry" many times;
4. pushd_ignore_dups removes only the first double entry.
(perhaps there was no need to explain that...)
So the solution is, AFAIK, really ${(u)...}.
> One other thing that just occurred to me is that a single line of
> output is unreliable when a directory name may contains whitespace.
> You should use:
> print -l $dirstack > ~/.zdirs
> dirstack=( ${(uf)"$(< ~/.zdirs)"} )
Or "dirs -pl" then.
> } I assumed I could treat dirstack as any other array since, well,
> } the *manual* says dirstack is "a normal array".
>
> I think "normal array" just means it's not an "associative array".
Were you guys surprised a user decided to use typeset on something
described as a "normal" array?
(users are cunning evil creatures and you should know it!)
8-D
Thank you for the explanations!
Cheers!
--
Francisco
Messages sorted by:
Reverse Date,
Date,
Thread,
Author