help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Things like ${parameter^} only works with path expansion


From: Peng Yu
Subject: Re: [Help-bash] Things like ${parameter^} only works with path expansion?
Date: Sat, 11 Apr 2015 11:11:29 -0500

On Sat, Apr 11, 2015 at 11:08 AM, Pierre Gaston <address@hidden> wrote:
>
>
> On Sat, Apr 11, 2015 at 6:45 PM, Peng Yu <address@hidden> wrote:
>>
>> Hi,
>>
>> The manual says things like ${parameter^} only works with path
>> expansion. I just want to make sure I understand it correctly. Pattern
>> Matching does not work here, right (as demonstrated by the following
>> example)?
>>
>> parameter=abcABC123ABCabc
>> echo "${parameter,,@(abcABC123ABCabc|ABCABC123ABCABC)}"
>>
>> Why this construct does not accept pattern matching, but things like
>> ${var%%pattern} does? Is it better to make them consistent to avoid
>> confusions?
>>
>> --
>> Regards,
>> Peng
>>
>
> The pattern after ,, and ^^ only matches one character at a time

I don't see this documented in the man page. Is there something
missing in the man page?

> eg:
> var=hello; echo "${var^^[el]}"
> prints hELLo because the pattern matches the characters e and l.
>
> (not sure what was the idea behind this feature)
>



-- 
Regards,
Peng



reply via email to

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