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,
Thanks as always Bart.