Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > gnu.bash.bug > #16882
| From | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: How get last commnda history line number directly |
| Date | 2020-09-01 09:05 -0400 |
| Organization | ITS, Case Western Reserve University |
| Message-ID | <mailman.1963.1598965529.2469.bug-bash@gnu.org> (permalink) |
| References | <1598951673480-0.post@n7.nabble.com> <b1ee5bd2-abbd-c72b-4701-68dc07640cb4@case.edu> |
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/
Back to gnu.bash.bug | Previous | Next | Find similar
Re: How get last commnda history line number directly Chet Ramey <chet.ramey@case.edu> - 2020-09-01 09:05 -0400
csiph-web