bug-bash
[Top][All Lists]
Advanced

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

Re: How get last commnda history line number directly


From: Chet Ramey
Subject: Re: How get last commnda history line number directly
Date: Tue, 1 Sep 2020 09:05:16 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

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.  Assignments to HISTCMD are ignored.  If HISTCMD is un-
       set, it loses its special properties, even if it is subsequently
       reset.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

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