Unix Shell - If HISTTIMEFORMAT var is set, then 'history' command prints

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > December 2007 > If HISTTIMEFORMAT var is set, then 'history' command prints





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

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

2007-12-02, 7:32 am

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
Cyrus Kriticos

2007-12-02, 1:29 pm

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

2007-12-02, 1:29 pm

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.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com