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

How to create unnamed temporary arrays?



Greetings,

I'm currently using something like this to list the base names of
files in /usr/local/etc/packages/ directory, each name on its own
line:

echo ${(F)$(echo /usr/local/etc/packages/*(.:t:r))}

This has the obvious problem that it doesn't work if filenames have
spaces in them.  I just couldn't figure out any way to do something
corresponding to:

kala=(/usr/local/etc/packages/*(.:t:r))
echo ${(F)kala}

without creating that temporary array variable.  Not that this
really matters in this case, but I've faced situations earlier
where avoiding the temporary name might have been more convenient
and now I finally have a simple enough example to demonstrate it.

So, is there a way?  I'm using zsh versions 3.1.9-dev-6 and
3.1.9-dev-8 from Debian GNU/Linux testing/unstable and stable,
respectively.

-- 
Hannu
Please don't send copies of list mail



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