baz
> how can i put a timestamp on my .bash_history file?
The only way I've found is (but I haven't given it much thought):
PROMPT_COMMAND='history -s `date`' ## format `date` however you like
I don't like it, as the dates get in the way when I cursor-up.
--
Chris F.A. Johnson http://cfaj.freeshell.org
===================================================================
My code (if any) in this post is copyright 2002, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License
> On 26 Jan 2002, bazzz777 wrote:
>
> > how can i put a timestamp on my .bash_history file?
>
> The only way I've found is (but I haven't given it much thought):
I spoke too soon.
> PROMPT_COMMAND='history -s `date`' ## format `date` however you like
>
> I don't like it, as the dates get in the way when I cursor-up.
Not only that, but it doesn't save the actual command!
Oh, well! Back to the drawing board.
"Chris F.A. Johnson" <c.f.a....@rogers.com> wrote in message news:<Pine.LNX.4.44.02012...@doublethink.workgroup>...
> i ended up with a cron job for this,
> 00,30 9-23 * * * echo "$(date)---------" >> /root/.bash_history
> not perfect but close enough.
If the purpose is just to manually do this as the need strikes (for
example to record the start and stop of various projects), you can
simply tye
`date` (no ENTER)
and then ESC CTRL-e ENTER, which of course generates an error but does
nonetheless stamp the history file. If you don't like the error, do
echo `date` ESC CTRL-e ENTER
or use ${date} instead of `date` if you prefer.
--
Tony Lawrence
SCO/Linux Support Tips, How-To's, Tests and more: http://pcunix.com