If HISTTIMEFORMAT var is set, then 'history' command prints

If I set HISTTIMEFORMAT var, then 'history' command
prints timestamps. For example:

HISTTIMEFORMAT="%c # "; history

But file ~/.bashrc_history contains no timestamps.
How can it print timestamps if '.bashrc_history' contains no
timestamps ?

Yakov
Yakov [ So, 02 Dezember 2007 13:59 ] [ ID #1883849 ]

Re: If HISTTIMEFORMAT var is set, then 'history' command prints timestamps. But

Yakov wrote:
> If I set HISTTIMEFORMAT var, then 'history' command
> prints timestamps. For example:
>
> HISTTIMEFORMAT="%c # "; history
>
> But file ~/.bashrc_history contains no timestamps.
> How can it print timestamps if '.bashrc_history' contains no
> timestamps ?

It's magic ;)



If you set HISTTIMEFORMAT the first time all entries prior to setting the
variable will get the time stamp of the time the variable was set.

Exit your bash, open a new one and take a look:

tail ~/.bashrc_history.

--
Best regards | Be nice to America or they'll bring democracy to
Cyrus | your country.
Cyrus Kriticos [ So, 02 Dezember 2007 14:44 ] [ ID #1883850 ]

Re: If HISTTIMEFORMAT var is set, then 'history' command prints timestamps. But

Yakov wrote:
> If I set HISTTIMEFORMAT var, then 'history' command
> prints timestamps. For example:
>
> HISTTIMEFORMAT="%c # "; history
>
> But file ~/.bashrc_history contains no timestamps.
> How can it print timestamps if '.bashrc_history' contains no
> timestamps ?

It's magic ;)



If you set HISTTIMEFORMAT the first time all entries prior to setting the
variable will get the time stamp of the time the variable was set.

Exit your bash, open a new one and take a look:

tail ~/.bash_history.

--
Best regards | Be nice to America or they'll bring democracy to
Cyrus | your country.
Cyrus Kriticos [ So, 02 Dezember 2007 14:49 ] [ ID #1883851 ]
Linux » comp.unix.shell » If HISTTIMEFORMAT var is set, then 'history' command prints

Vorheriges Thema: vi break apart multiple email addresses in one line.
Nächstes Thema: Re: cdrtool for solaris 10 x86