bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: case modification won't work with pattern


From: Clark J. Wang
Subject: Re: case modification won't work with pattern
Date: Fri, 11 Mar 2011 10:04:12 +0800

On Thu, Mar 10, 2011 at 9:31 PM, Greg Wooledge <address@hidden> 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]