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

Re: string to array space problem in filenames

On Fri, Aug 28, 2015 at 4:05 AM, Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
> Gentlemen:
> I should probably know this, but I'm rusty after a few months not thinking
> about zsh.  I have a personal implementation of a dirstack that just pushes
> $PWD to the end of a file then rereads the file to an array which is then
> sent to 'select' to let me change directory. I like it because it survives
> reboot and works across xterms and removes duplicates and so on.  The only
> thing that trips it up is when a directory is pushed that contains a space.
> I have few of those, so it's just an irritation, still I'd like to fix it if
> possible.  Here's one of the offending directories:
>     pts/1 HP-w5--5-Debian1 root /root/.icedove/Ray/Mail/Local Folders
> ... which 'select' does this with:
> 1) QUIT
> 2) /aWorking/Zsh
> 3) Folders
> 4) /root/.icedove/Ray/Mail/Local
> ... because it breaks at the space, obviously.  Is there some way around
> that?  I've tried various quotes and slashes and incantations and spells,
> but no luck.  I expect that 'select' can't be expected to behave differently
> so somehow the array needs to know to protect spaces in directory names.
> I'm fuzzified why protecting them with quotes doesn't do it.

You forgot to include your code in the mail.

Mikael Magnusson

Messages sorted by: Reverse Date, Date, Thread, Author