help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] Adding a marker line to history at interactive shell start (


From: Dennis Williamson
Subject: [Help-bash] Adding a marker line to history at interactive shell start (and history timestamps)
Date: Thu, 21 Jun 2012 20:56:55 -0500

I am trying to add a marker line to the bash history list when an
interactive (Bash) shell is started. When I try the commands shown
below, I get the line that I want, but their is no timestamp so the
output of the history command is wrong.

In a file in /etc/profile.d which gets sourced by /etc/profile, I have
the following lines:

HISTTIMEFORMAT='%c : '
set -o history
history -s "# some text as a marker with $vars"

The comment line gets added, but their is no timestamp for it, so when
I issue the history command I get output such as the following:

519  ??some command from an earlier session
520  ??and another
521  ??# some text as a marker
522  Thu, Jun 21, 2012  8:53:05 PM : history

Other commands which are entered at the prompt have the correct
timestamp prefixed.

I don't want to append to `~/.bash_history` directly in order to keep
the marker near the rest of the session.

I'm using Bash 4.1.

How can I have this work the way I expect?

I have posted a question at http://unix.stackexchange.com/q/39833/382
and not gotten any usable responses.

-- 
Visit serverfault.com to get your system administration questions answered.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]