Bash capital–non-capital substitution

Johnny Rosenberg gurus.knugum at gmail.com
Sat Oct 26 12:53:03 UTC 2013


x="hello"
echo ${x} → hello
echo ${x^} → Hello
echo ${x^^} → HELLO

So far, so good.

x="HELLO"
echo ${x} → HELLO
echo ${x,} → hELLO
echo ${x,,} → hello

Still good.

echo ${x^} → HELLO
echo ${x^,} → HELLO

Question: How to do ”HELLO” → ”Hello” in one step?

I can do it in two steps, of course:
y=${x,,}; echo ${y^} → Hello


Johnny Rosenberg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20131026/e0267629/attachment.html>


More information about the ubuntu-users mailing list