One expression to get the first letter of a string and capitalize it
From:
Peng Yu
Subject:
One expression to get the first letter of a string and capitalize it
Date:
Tue, 24 Aug 2021 08:01:05 -0500
x=abc
y=${x:0:1}
echo "${y^^}"
I want to get the first letter of a string and capitalize it. Ideally,
I want it to be done in one expression. But I only know how to do it
with two expressions.
Is there a way to do it in a more concise manner (without using an
extra variable, or definition of a new function, etc)?
--
Regards,
Peng