[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Exclamation mark when using character classes
From: |
Lawrence Velázquez |
Subject: |
Re: Exclamation mark when using character classes |
Date: |
Sat, 21 Aug 2021 13:05:07 -0400 |
> On Fri, Aug 20, 2021 at 10:30 PM hancooper via Bug reports for the GNU
> Bourne Again SHell bug-bash@gnu.org wrote:
>
> I am using EPOCHREALTIME and then computing the corresponding human
> readable form, that can handle
> changes in locale
> now=$EPOCHREALTIME
> printf -v second '%(%S)T.%s' "${now%[^[:digit:]]}" "${now#[^[:digit:]]}"
> printf -v minute '%(%M)T' "${now%[^[:digit:]]}"
> printf -v hour '%(%H)T' "${now%[^[:digit:]]}"Incidentally, [![:digit:]] does
> not work there, you need to use the
> POSIX-specified caret (^) instead of an
> exclamation mark when using character classes. I'm not sure if this is
> intentional or a bug in bash; man
> page doesn't seem to mention it.
https://lists.gnu.org/archive/html/help-bash/2021-08/msg00120.html
> On Aug 21, 2021, at 10:55 AM, hancooper <hancooper@protonmail.com> wrote:
>
> I got it backwards. POSIX specifies ! for use in globs, and bash
> permits ^ as an extension, for people who are used to ^ from regular
> expressions.
>
> Had "tested" this using grep or [[ =~ ]] or something else that uses
> regular expressions, not globs.
https://lists.gnu.org/archive/html/help-bash/2021-08/msg00125.html
Why are you reposting other people's messages from a different
mailing list, without attribution?
--
vq