Groups | Search | Server Info | Login | Register


Groups > gnu.bash.bug > #16881

Re: How get last commnda history line number directly

From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: How get last commnda history line number directly
Date 2020-09-01 08:32 -0400
Message-ID <mailman.1960.1598963575.2469.bug-bash@gnu.org> (permalink)
References <1598951673480-0.post@n7.nabble.com> <20200901123222.GV931@eeg.ccf.org>

Show all headers | View raw


On Tue, Sep 01, 2020 at 02:14:33AM -0700, almahdi wrote:
> How to get last commnda history line number purely & directly on bash script
> or prompt ?
> 
> as it's pure & directly viable in PS1 env. var.
> PS1=`echo \!`
> 
> confusingly bash 'mainstream' itself wasn't found way to do

unicorn:~$ x='\!'; echo "${x@P}"
590

I don't know how you plan to *use* this, though.  It sounds like an X-Y
problem to me.

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: How get last commnda history line number directly Greg Wooledge <wooledg@eeg.ccf.org> - 2020-09-01 08:32 -0400

csiph-web