bug-bash
[Top][All Lists]
Advanced

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

Re: Add option to just print history, with no added timestamps or line n


From: Dan Jacobson
Subject: Re: Add option to just print history, with no added timestamps or line numbers
Date: Sat, 13 Apr 2024 07:45:51 +0800

>>>>> "CR" == Chet Ramey <chet.ramey@case.edu> writes:
CR> On 3/24/24 11:39 PM, Lawrence Velázquez wrote:
>> On Sun, Mar 24, 2024, at 11:01 PM, Dan Jacobson wrote:
>>> P.S., "\t%s" seems to have an extra space squeezed between them with
>>> bash: "\t %s",
>>> unless perhaps the spec says that %s always starts with a space.
>> The standard doesn't say that, so in native mode bash's `fc' is
>> indeed slightly nonconformant, but in POSIX mode it does omit the
>> extra space.

CR> That character is a `*' if the line has been modified (has an existing
CR> set of edits to undo) and ` ' if not. This is what `history' does.

Ah ha! Therefore I would recommend changing this part of the Bash man page,

       history -s arg [arg ...]
              With  no options, display the command history list with line num-
              bers.  Lines listed with a * have been modified.

to say

       history -s arg [arg ...]
              With  no options, display the command history list. Each
              line consists of a line number, then a * if the line has
              been modified, else a blank. Then a blank, then a
              timestamp, then a blank, then the command.

Or maybe

      history -s arg [arg ...]
              With  no options, display the command history list, in the
              following printf format:
              "%5d %s %s %s", $number, $modified, $timestamp, $command,
              where $modified is "*" if modified, " " if not.

Well something like that. Helps people who are parsing history.



reply via email to

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