help-bash
[Top][All Lists]
Advanced

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

Re: printf %()T


From: Greg Wooledge
Subject: Re: printf %()T
Date: Fri, 28 Apr 2023 07:23:58 -0400

On Thu, Apr 27, 2023 at 10:39:58PM -0500, Mike McClain wrote:
> mike@RPI4b2:~>  printf %(+%a %-d %b. %Y %-k:%M) T
> -bash: syntax error near unexpected token )'
[...]

In almost all cases, you want single quotes around the printf format
specifier.  This allows you to put all that weird punctuation inside
it without having to worry about what gets expanded, which backslashes
are removed prematurely, what gets treated as a shell metacharacter, etc.

unicorn:~$ printf '%(%Y-%m-%d %H:%M:%S)T\n' -1
2023-04-28 07:22:56



reply via email to

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