[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Adding a marker line to history at interactive shell sta
From: |
Chet Ramey |
Subject: |
Re: [Help-bash] Adding a marker line to history at interactive shell start (and history timestamps) |
Date: |
Sat, 23 Jun 2012 15:36:51 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 |
On 6/21/12 9:56 PM, Dennis Williamson wrote:
> 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:
Try running `set -H' or adding an assignment to histchars:
histchars='!^#'
before the `history -s'.
The history timestamp code prefixes the timestamp with the history comment
character, but the history comment character is '\0' by default. Later on,
when bash does history initialization, it's set, but it's unchanged when
the profile code is running.
I wonder if it would be a good idea to set the history comment character
to the bash default (`#') if it's '\0' when HISTTIMEFORMAT is set or
modified.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU address@hidden http://cnswww.cns.cwru.edu/~chet/