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

Re: Simpler for statements



On 08/12/2007, Jörg Sommer <joerg@xxxxxxxxxxxx> wrote:
> Hi,
>
> I look for a way to ease writing of for loops. I often have commands like
> for i in other_files.*; do cmp file $i; done
>
> Is there a better way to do this? Can I somehow improve my little
> function?

I like the
for a (other_files.*) {cmp file $a}
syntax, but I guess it depends on how easy it is to input {}() on your layout.
zsh will also allow
for a in other_files.*;cmp file $a
probably requires setopt shortloops, but a downside is you can't use ;
in the command.

-- 
Mikael Magnusson


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