On Sat, Sep 06, 2025 at 23:10:28 -0500, Eric Pruitt wrote:
> I've never read the Bash documentation cover-to-cover. I've been using
> "^^" and ",," for years without being aware they were undocumented
> because I had seen them used elsewhere, and it never crossed my mind
> that they might be undocumented. I'm sure other people also fall into
> this camp.

^^ and ,, are documented.  In fact, it's *really* easy to find it,
because you just have to search for ,, and there are no false positives
in the way.

       ${parameter^pattern}
       ${parameter^^pattern}
       ${parameter,pattern}
       ${parameter,,pattern}
              Case  modification.   This  expansion modifies the case of alpha‐
              betic characters in parameter. [...]

The undocumented syntax is ~ ~~ which does case flipping like vi's ~
command.  That's what this thread has been talking about.

hobbit:~$ x='Hello World'; echo "${x~}"
hello World
hobbit:~$ x='Hello World'; echo "${x~~}"
hELLO wORLD
hobbit:~$ x='Hello World'; echo "${x~~[AaEeIiOoUu]}"
HEllO WOrld

Nobody has shown a real-world use case for this yet.

Reply via email to