[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How get last commnda history line number directly
From: |
Greg Wooledge |
Subject: |
Re: How get last commnda history line number directly |
Date: |
Wed, 9 Sep 2020 14:32:56 -0400 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
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 '!' support (I generally found
> > > '!' more often did unwanted things, but I never used csh):
> >
> > You're talking abuot csh-style history expansion (set -o histexpand),
> > right? That has nothing to do with the expansion of \! within PS1.
> >
> > I've got histexpand disabled, and PS1='\! ' gives the number just fine.
> Like this?
> # t='\! '
> # echo $t
> \!
> ---
> As I said, doesn't work if you don't have '!' support.
No. I said PS1='\! ' and that's what I meant. Not some other random
variable.
unicorn:~$ PS1='\! '
502 echo hi
hi
503