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

Re: PATCH: expanding parameters like echo/print builtins



On May 11,  5:14pm, Mikael Magnusson wrote:
} Subject: Re: PATCH: expanding parameters like echo/print builtins
}
} On 11 May 2011 17:03, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
} >
} > I'd probably have done it with ${(%)arr:gs/%/%%}
} 
} Yeah, me too, except (%) doesn't expand \u304c or \0123, or any of the
} other stuff that (g) expands :).

Hrm.  What was I thinking of?  Obviously hadn't eaten breakfast yet.
 
} I looked at the list of letters and the first free one was b, so i
} picked that, then when i got as far as discover that the function is
} called getkeystring and noticed g was also free, i went with that.
} [...] The following characters are taken:
} #%@AacCDefFikLnoOPqQtuUvVwWXz0p~jlmrsZ_lBEMNR

So ...

x='#%@AacCDefFikLnoOPqQtuUvVwWXz0p~jlmrsZ_lBEMNR'
y=( {$[##a]..$[##z]} {$[##A]..$[##Z]} )
print ${${(#)y}:#[$x]}

b d g h x y G H I J K S T Y

I guess (g) is as good as anything, unless someone prefers to save the
lowercase letters and go with (G).



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