[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: HISTCMD variable always returns 1 when used in PROMPT_COMMAND, bash
From: |
Chet Ramey |
Subject: |
Re: HISTCMD variable always returns 1 when used in PROMPT_COMMAND, bash 3.1 |
Date: |
Tue, 27 Dec 2005 18:13:54 -0500 |
User-agent: |
Thunderbird 1.5 (Macintosh/20051201) |
Arjen Meek wrote:
> Hello,
>
> I'm having a problem in bash 3.1 that I'm pretty sure is a bug. As
> indicated in the subject, the HISTCMD variable always returns 1 when
> used in PROMPT_COMMAND , rather than the actual number of the current
> line in the history.
It's not a bug. Bash-3.1 returns the history position as the value
of HISTCMD only when it's actually saving commands on the history list
(which non-interactive execution like PROMPT_COMMAND evaluation has
never done). Bash-3.0 returned essentially random values when it
wasn't saving commands to the history, as long as HISTSIZE was set.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
Live Strong.
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/