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

Re: string to array space problem in filenames



On 08/28/2015 12:43 PM, Bart Schaefer wrote:
Your first problem here is trying to maintain .mydirstack all as one
line (echo -n) with spaces between the fields.  You would be much
better served by writing one file name per line and then splitting
the file on newlines when reading it back.

Out:
     echo "$PWD" >>| ~/.mydirstack
In:
     mydirstack=( ${(f)"$(<~/.mydirstack)"} )

Then you should be able to do

     select dir in "${mydirstack[@]}"; do something with $dir; done

If you insist on storing it all on one line,
Heck no, I don't insist on anything. The single line thing was the only way I could get it to work, but the above sounds very much better even on first reading. I'm still lacking free time, but I'll play with that and get back to you.

Thanks as always Bart.



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