bug-bash
[Top][All Lists]
Advanced

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

Re: multi-line commands in the history get split when bash is quit


From: Michael Witten
Subject: Re: multi-line commands in the history get split when bash is quit
Date: Sat, 05 Feb 2011 18:02:26 -0800 (PST)

On Sat, Feb 5, 2011 at 19:15, Jon Seymour <jon.seymour@gmail.com> wrote:
> Here's the format I see in my history.
>
> #1296950184
> for i in 1 2
> do
> echo $i
> done
> #1296950194
> exit
>
> HISTTIMEFORMAT is:
>
> HISTTIMEFORMAT='[%m.%d.%y] %T   '
>
>
> bash -version is:
>
> GNU bash, version 3.2.25(1)-release (i686-redhat-linux-gnu)
> Copyright (C) 2005 Free Software Foundation, Inc.
>
> jon.

As you can see, the timestamp that is actually recorded is
the format '%s' rather than the one given by "$HISTTIMEFORMAT".

>From `man bash':

    HISTTIMEFORMAT
              If this variable is set and not null, its value is used
              as a format string for strftime(3) to print the time
              stamp associated with each history entry displayed by
              the history builtin. If this variable is set, time
              stamps are written to the history file so they may be
              preserved across shell sessions. This uses the history
              comment character to distinguish timestamps from other
              history lines.

namely:
                                                    its value is used
              as a format string for strftime(3) to print the time
              stamp associated with each history entry displayed by
              the history builtin.

So, if you run `history', you'll not only get the commands in the
history list, but you'll also get the time at which the commands
were last run (formatted according to "$HISTTIMEFORMAT").

In other words, it's not helpeful in this case.



reply via email to

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