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

Re: How to create unnamed temporary arrays?



On 20 Feb 2001, Hannu Koivisto wrote:

> Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx> writes:
> 
> | If I got that right and you really only want those filenames one per
> 
> Not quite; that package listing job was just a simple example using
> which I was able to demonstrate the kind of situations in which I
> might want to create unnamed temporary arrays.  I.e. I'd really like
> to know if it is possible to rewrite this...
> 
> kala=(/usr/local/etc/packages/*(.:t:r))
> echo ${(F)kala}
> 
> ...so that kala variable is not defined but the ${(F)...}
> construction is still used.
> 

The idea I had today (in relation to other things) was to introduce new
syntax, something like

${foo-(bar baz)}

(note braces). Combined with empty parameter name (it is legal) it makes
it possible to do

${(F)${:-(foo bar baz)}}

thus giving you exactly what you want.

I do not claim that I fully understand the parameter substitution code,
but it looks doable. There remain some decisions to make though. 

-andrej



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