help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: One expression to get the first letter of a string and capitalize it


From: ikhxcsz7y xmbott
Subject: Re: One expression to get the first letter of a string and capitalize it
Date: Tue, 24 Aug 2021 20:06:57 +0200

you need, more than one cmd for this, as you did

On Tue, Aug 24, 2021, 20:06 Peng Yu <pengyu.ut@gmail.com> wrote:

> But I just want to get the first letter.
>
> On 8/24/21, Dennis Williamson <dennistwilliamson@gmail.com> wrote:
> > On Tue, Aug 24, 2021, 8:01 AM Peng Yu <pengyu.ut@gmail.com> wrote:
> >
> >> 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
> >>
> >
> >
> > Use one carat instead of two.
> >
> > echo "${x^}"
> >
> >>
> >
>
>
> --
> Regards,
> Peng
>
>


reply via email to

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