On Sat, Jan 20, 2024 at 08:55:51PM +0100, Paxsali via wrote:
> echo ${a,b}
>
> I have the latest bash reference manual in front of me and I cannot find
> this form of brace or shell parameter expasion.
${parameter^pattern}
${parameter^^pattern}
${parameter,pattern}
${parameter,,pattern}
Case modification. This expansion modifies the case of alpha‐
betic characters in parameter. The pattern is expanded to pro‐
duce a pattern just as in pathname expansion. Each character in
the expanded value of parameter is tested against pattern, and,
if it matches the pattern, its case is converted.
What this expansion would do, therefore, is convert all of the 'b'
characters in the value of $a to lowercase. Since 'b' is already
lowercase, it would be a no-op.
Nevertheless, it is valid syntax.
Here's a similar example that actually does something:
unicorn:~$ a=Banana
unicorn:~$ echo "${a,B}"
banana