Re: How get last commnda history line number directly

2020-09-10 Thread L A Walsh
On 2020/09/09 11:32, Greg Wooledge wrote: No. I said PS1='\! ' and that's what I meant. Not some other random variable. unicorn:~$ PS1='\! ' 502 echo hi hi 503 === Thanks for clarifying. That does work for me. I still had it stuck in my head as having to do with general variable usage as y

Re: How get last commnda history line number directly

2020-09-09 Thread Greg Wooledge
On Wed, Sep 09, 2020 at 11:29:01AM -0700, L A Walsh wrote: > On 9/8/2020 5:11 AM, Greg Wooledge wrote: > > On Sun, Sep 06, 2020 at 01:18:22PM -0700, L A Walsh wrote: > > > > as it's pure & directly viable in PS1 env. var. > > > > PS1=`echo \!` > > > --- > > > Doesn't work if you don't have '!' supp

Re: How get last commnda history line number directly

2020-09-09 Thread L A Walsh
On 9/8/2020 5:11 AM, Greg Wooledge wrote: On Sun, Sep 06, 2020 at 01:18:22PM -0700, L A Walsh wrote: as it's pure & directly viable in PS1 env. var. PS1=`echo \!` --- Doesn't work if you don't have '!' support (I generally found '!' more often did unwanted things, but I never used csh

Re: How get last commnda history line number directly

2020-09-08 Thread Chet Ramey
On 9/6/20 4:18 PM, L A Walsh wrote: > history 3 > 2983  echo "this is on what history line? ($HISTCMD)" > 2984  echo $(($HISTCMD-2)) > 2985  history 3 > > Seems to only give correct line from history by subtracting 2? > Maybe its different in 5.x? When readline stores history entries, it stores

Re: How get last commnda history line number directly

2020-09-08 Thread Greg Wooledge
On Sun, Sep 06, 2020 at 01:18:22PM -0700, L A Walsh wrote: > > as it's pure & directly viable in PS1 env. var. > > PS1=`echo \!` > --- > Doesn't work if you don't have '!' support (I generally found > '!' more often did unwanted things, but I never used csh): You're talking abuot csh-style history

Re: How get last commnda history line number directly

2020-09-06 Thread L A Walsh
On 2020/09/01 05:32, Greg Wooledge wrote: On Tue, Sep 01, 2020 at 02:14:33AM -0700, almahdi wrote: > How to get last commnda history line number? as it's pure & directly viable in PS1 env. var. PS1=`echo \!` --- Doesn't work if you don't have '!' support (I generally found '!' more often d

Re: How get last commnda history line number directly

2020-09-01 Thread Chet Ramey
On 9/1/20 5:14 AM, 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 \!` HISTCMD The history number, or index in the history list, of the current command. Assig

Re: How get last commnda history line number directly

2020-09-01 Thread Greg Wooledge
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='

How get last commnda history line number directly

2020-09-01 Thread almahdi
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 -- Sent from: http://gnu-bash.2382.n7.nabble.com/