On Sun, Feb 05, 2006 at 07:02:10PM -0500, Chris F.A. Johnson wrote: > On Sun, 5 Feb 2006, Felipe Kellermann wrote: > > >On Thu, 2 Feb 2006 11:13pm -0500, Mike Frysinger wrote: > > > >>upper case or lower case ... if 'tr' was a bash builtin, then that'd work > >>with some `echo | tr` magic, but it something like > >>${foo//[[:lower:]]/[[:upper:]]} would be nice > >>-mike > > > >typeset -u (ksh, zsh) supported in bash would be nice... > > > > orchid% typeset -u fuu > > So long as it uses declare, not typeset :) > > > orchid% fuu=bar > > orchid% echo $fuu > > BAR > > I'd prefer variable expansion, perhaps the way Mike suggested, or, > e.g.: > > $ foo=bar > $ echo ${foo^} ## Convert first character > Bar > $ echo ${foo^^} ## Convert all characters > BAR > $ echo ${foo^[a-m]} ## Convert first character that matches pattern > Bar > $ echo ${foo^^[a-m]} ## Convert all characters that match pattern > BAr [...]
Also note zsh parameter expansion flags that can be easily combined: $ foo=bar $ echo ${(U)foo} BAR $ echo ${(Ul:20::.:)foo} .................BAR $ echo ${(Uqq)foo} 'BAR' -- Stéphane _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash