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

Re: ZSH's future [longish] ?



> Z> But it can also be used as a powerful script language.  An example:
> Z> with my releases the expansion of ${${(f)$(</etc/group)}%%:*} gives
> Z> the list of the group names from /etc/groups.
> 
> Uh-oh. If I use the (f) qualifier I only get the first line -- without
> it, I get all the group names in a single line separated by
> whitespace. A bug in my (old) hzoli version -- 2.6-beta11-test7-hzoli11 --
> perhaps? 

No, not a bug.  I forgot to mention that it should be put inside double
quotes.  Without double quotes word splitting is done on $(</etc/group) which
removes line breaks.  Double quotes disable word splitting but the explicit
(f) qualifier forces line splitting which is later handled like an array.
Even rc_expand_param can be used, just try "/${^${(f)$(</etc/group)}%%:*}/".
And this is only a simple example...

Cheers,
  Zoltan



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