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

--
   Chris F.A. Johnson                      <http://cfaj.freeshell.org>
   ===================================================================
   Author:
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to