On 3/10/11 9:04 PM, Clark J. Wang wrote: > On Thu, Mar 10, 2011 at 9:31 PM, Greg Wooledge <wool...@eeg.ccf.org> wrote: > >> On Thu, Mar 10, 2011 at 10:22:12AM +0800, Jerry Wang wrote: >>> var="abcabc" >>> echo "var: ${var}" >>> echo "replace the leading \"ab\" to uppercase: ${var^ab}" # expect >> to get "ABcabc" ? >> >> The documentation is a bit terse, admittedly. > > > Agree. Almost all of the poeple around me don't understand why it works that > way. Maybe some background of the feature requirement can help us to > understand better.
The original requests were for a way to change the first letter or every letter to uppercase or lowercase, like ksh typeset -l/-u, using word expansion syntax (one request was for a new builtin command to do it). That's what you get if you don't use the pattern part of the expansion. I invented the pattern following the case specifier to allow each character to be separately modified. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/