[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: printf %()T
From: |
Roger |
Subject: |
Re: printf %()T |
Date: |
Tue, 2 May 2023 08:28:35 -0400 |
Definitely see this now, under printf
sub-heading:
%(datefmt)T
Since I looked this up a few days ago and going from vague memory,
think what I meant to say, maybe an example within the printf section
is lacking.
I was noticing with my very initial tests, quotes/parenthesis were
required for any strtime variables to print. With the current
explanation, users would likely need to further search the Internet
for examples.
The date command is frequently pulled into all of my scripts.
Seemingly introduced in bash-4.2, eh, flew over my nest.
On 5/2/23, Seth David Schoen <schoen@loyalty.org> wrote:
> Roger writes:
>
>> I did not find the printf date incantation within man bash, however these
>> Emails are highlighted here for future reference.
>
> Mine has
>
> %(datefmt)T
> causes printf to output the date-time string
> resulting
> from using datefmt as a format string for
> strftime(3).
> The corresponding argument is an integer representing
> the
> number of seconds since the epoch. Two special
> argument
> values may be used: -1 represents the current time,
> and
> -2 represents the time the shell was invoked. If no
> ar‐
> gument is specified, conversion behaves as if -1 had
> been
> given. This is an exception to the usual printf
> behav‐
> ior.
>
> Do you have that?
>