help-bash
[Top][All Lists]
Advanced

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

printf %()T


From: Mike McClain
Subject: printf %()T
Date: Thu, 27 Apr 2023 22:39:58 -0500
User-agent: Mutt/1.10.1 (2018-07-13)

    Regarding a message Subject: alias not working, I'd like to thank
Greg Wooledge and alex xmb ratchev for the tips to getting what I want.

    In response to said message Greg Wooledge said, "The printf command
can generate timestamps without needing to call date(1)."

    I found in 'help printf' the same claim and in 'man 3 strftime'
the format strings allowed but can't seem to find how to use that info.

    I've tried many combinations but no joy.

    Would someone please post a sample that works?

    These didn't work but some of them seemed to try putting a couple
of characters but nothing I could make sense of.

mike@RPI4b2:~>  printf %(+%a %-d %b. %Y %-k:%M) T
-bash: syntax error near unexpected token )'
mike@RPI4b2:~>  printf %('+%a %-d %b. %Y %-k:%M') T
-bash: syntax error near unexpected token ('
mike@RPI4b2:~>  printf %('+%a %-d %b. %Y %-k:%M')T
-bash: syntax error near unexpected token ('
mike@RPI4b2:~>  printf %(+%a %-d %b. %Y %-k:%M)T
-bash: syntax error near unexpected token ('
mike@RPI4b2:~> printf %(+a -d b. Y -k:M)T
-bash: syntax error near unexpected token ('
mike@RPI4b2:~>  printf %'+%a %-d %b. %Y %-k:%M'T
-bash: printf: %': invalid format character
mike@RPI4b2:~> printf '+%a %-d %b. %Y %-k:%M'T
-bash: printf: Y': invalid format character
+0x0p+0 0 . mike@RPI4b2:~>
mike@RPI4b2:~> printf '+%a %-d %b. %Y %-k:%M'T
-bash: printf: Y': invalid format character
+0x0p+0 0 . mike@RPI4b2:~>  printf '+%a %-d %b. %Y %-k:%M'T
-bash: printf: Y': invalid format character
+0x0p+0 0 . mike@RPI4b2:~>
mike@RPI4b2:~>  printf '+%a %-d %b'T
+0x0p+0 0 Tmike@RPI4b2:~>  printf '+%D'T
-bash: printf: D': invalid format character
+mike@RPI4b2:~>  printf '%D'T
-bash: printf: D': invalid format character
mike@RPI4b2:~> printf '%a %d %b'T
mike@RPI4b2:~>  printf %'a d b'T
0x0p+0 d bTmike@RPI4b2:~>
mike@RPI4b2:~>

Thanks,
Mike
--
"If you're not careful, the newspapers will have you hating the people
who are being oppressed, and loving the people who are doing the oppressing."
    - Malcolm X




reply via email to

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