[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: $HISTCMD in command substitution?
From: |
Chet Ramey |
Subject: |
Re: $HISTCMD in command substitution? |
Date: |
Mon, 27 Jan 2020 09:41:42 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 |
On 1/26/20 8:18 PM, Jack Bates wrote:
> Is there a way to access the $HISTCMD variable from a command substitution?
> e.g.
>
>> echo "$(echo "$HISTCMD")"
In bash versions through 5.0, no: $HISTCMD is a dynamic variable that
depends on the state of the history, and history is disabled in a command
substitution.
The devel branch has relaxed this restriction slightly, and will expand
$HISTCMD to the history number that was current when the command
substitution started.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU address@hidden http://tiswww.cwru.edu/~chet/