help-bash
[Top][All Lists]
Advanced

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

Re: $HISTCMD in command substitution?


From: Jack Bates
Subject: Re: $HISTCMD in command substitution?
Date: Sat, 22 Feb 2020 09:31:02 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0

On 2020-01-27 7:41 a.m., Chet Ramey wrote:
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.

Thank you for your help! Is there currently any way to access $HISTCMD from a bind -x shell-command?



reply via email to

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