the version of bash is less than 3.0
export PROMPT_COMMAND='{
date "+: %c; `history 1 | { read x cmd; echo "$cmd"; }`";
} >> $HOME/.history-timestamp'
我的更改(加入.bash_profile):
echo "" >>$HOME/.history-timestamp
date "+: %c; $USER ;login!" >>$HOME/.history-timestamp
export PROMPT_COMMAND='{
date "+: %c; $USER ; $? ; `pwd` ; `history 1 | { read x cmd; echo "$cmd"; }`";
} >> $HOME/.history-timestamp'
bash 3.0
set the variable HISTTIMEFORMAT
bb. New HISTTIMEFORMAT variable; value is a format string to pass to
strftime(3). If set and not null, the `history' builtin prints out
timestamp information according to the specified format when displaying
history entries. If set, bash tells the history library to write out
timestamp information when the history file is written.
export HISTTIMEFORMAT="%F %H:%M "
阅读(1316) | 评论(0) | 转发(0) |