Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [zsh] dirstack history: loving zsh, crashing zsh...



» 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