Hide Forgot
Description of problem: The bash man page says the following about the variable HISTTIMEFORMAT: HISTTIMEFORMAT If this variable is set and not null, its value is used as a format string for strftime(3) to print the time stamp associated with each history entry displayed by the history builtin. If this variable is set, time stamps are written to the history file so they may be preserved across shell sessions. However no matter what strftime(3) string you use, or even if you use the number 1, you will always get unix epoch time. Steps to Reproduce: 1. create /etc/profile.d/bash_history.sh with the following contents: HISTTIMEFORMAT="%Y%m%d_%H:%M:%S" export HISTTIMEFORMAT 2. log out, log back in 3. run some commands 4. log out, log back in, and check the format of the commented # lines in ~/.bash_history 5. change the variable to whatever format you want (including any non-zero number) and verify no change in logging Actual results: Time string is always in unix epoch time. Expected results: Time string logged should be in the strftime(3) format specified by the HISTTIMEFORMAT variable.
HISTTIMEFORMAT works with `history' builtin. What does `history' shows you when you set up HISTTIMEFORMAT variable?
ah ok, so the format in the history file is always in epoch time, it's just the env var modifies the display. totally read that wrong. I guess this can be closed, history works as expected.