Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timestamp format not compatible with older (<=4.2) version of bash #257

Open
phlenoir opened this issue Apr 9, 2020 · 0 comments
Open

Comments

@phlenoir
Copy link

phlenoir commented Apr 9, 2020

Due diligence

I have searched the Bash changelog for information and found in the section.

This document details the changes between this version, bash-4.3-alpha,
and the previous version, bash-4.2-release.

That:

dd. The `printf' %(...)T format specifier now uses the current time if no argument is supplied.

Framework, Bash, and operating system version information

_GO_CORE_VERSION:         v1.7.0
BASH_VERSION:             4.2.46(2)-release
OSTYPE:                   linux-gnu
_GO_PLATFORM_ID:          amzn
_GO_PLATFORM_VERSION_ID:  2018.03

Description

Unfortunately Amazon provides bash version 4.2 in standard EC2 and the bash bultin printf %(...)T returns the EPOCH zero time instead of the current time.

$ printf "%('%Y-%m-%d %H:%M:%S')T\n" 
'1970-01-01 00:00:00'
$ printf "%('%Y-%m-%d %H:%M:%S')T\n" -1
'2020-04-09 08:35:09'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant