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. > What the ^ operator > does is compare the *first character* of var to the *glob pattern* which > follows the ^. If the character matches the glob, it gets capitalized. > > No single character is ever going to match the glob "ab", because it's > two characters long. > -- Clark J. Wang