go-script-bash icon indicating copy to clipboard operation
go-script-bash copied to clipboard

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

Open phlenoir opened this issue 5 years ago • 0 comments

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'

phlenoir avatar Apr 09 '20 08:04 phlenoir