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: Pierre Gaston
Subject: Re: [Help-bash] Things like ${parameter^} only works with path expansion?
Date: Sat, 11 Apr 2015 19:08:29 +0300

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 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)


reply via email to

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