help-bash
[Top][All Lists]
Advanced

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

Re: $HISTCMD in command substitution?


From: Greg Wooledge
Subject: Re: $HISTCMD in command substitution?
Date: Mon, 27 Jan 2020 09:09:14 -0500
User-agent: Mutt/1.10.1 (2018-07-13)

On Sun, Jan 26, 2020 at 06:18:32PM -0700, Jack Bates wrote:
> Is there a way to access the $HISTCMD variable from a command substitution?
> e.g.
> 
> > echo "$(echo "$HISTCMD")"

wooledg:~$ echo "$HISTCMD"
558
wooledg:~$ echo "$(echo "$HISTCMD")"
1

It's really unclear what you intend to do with this variable.  Having said
that, though, you could simply copy the value into another variable,
one with no special properties, and then use that in the subshell.

wooledg:~$ y=$HISTCMD; echo "$(echo "$y")"
560



reply via email to

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