Re: [ksh] Show command number in shell prompt

Liste des GroupesRevenir à cu shell 
Sujet : Re: [ksh] Show command number in shell prompt
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.unix.shell
Date : 25. Sep 2024, 01:24:02
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vcvl72$3d38m$1@dont-email.me>
References : 1 2 3 4 5 6
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 25.09.2024 01:35, Keith Thompson wrote:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
[...]
If you use numbered history references, they refer to the history
number, not the command number.  For example, !25 will execute the 25th
command from your history.  This could be confusing if you show the
command number in $PS1.
 
And of course the "history" command shows history numbers, not command
numbers.
 
The command number doesn't seem to be used for anything other than
showing the number of commands issued in the current shell process.
(Personally, I don't find the command number to be useful information.)

Terminology obviously varies; ksh speaks only about "command number"
and refers to it as '!' in the prompt, and all the history commands
(or aliases), fc, hist, history, speak only about "command numbers".

So bash's "history numbers" ('\!') are the equivalent of ksh's
"command numbers" ('!') - a potential source of confusion?

BTW: POSIX 'fc' speaks also about "reference commands by number".

Bash's explanation:
"The  command  number and the history number are usually different: the
 history number of a command is its position in the history list, which
 may  include  commands  restored  from  the  history file (see HISTORY
 below), while the command number is the position in  the  sequence  of
 commands  executed during the current shell session."

Hmm...

Janis


Date Sujet#  Auteur
24 Sep 24 * [ksh] Show command number in shell prompt12Janis Papanagnou
24 Sep 24 `* Re: [ksh] Show command number in shell prompt11Janis Papanagnou
24 Sep 24  +- Re: [ksh] Show command number in shell prompt1Janis Papanagnou
24 Sep 24  +* Re: [ksh] Show command number in shell prompt3Keith Thompson
25 Sep 24  i`* Re: [ksh] Show command number in shell prompt2Keith Thompson
25 Sep 24  i `- Re: [ksh] Show command number in shell prompt1Janis Papanagnou
24 Sep 24  `* Re: [ksh] Show command number in shell prompt6Lawrence D'Oliveiro
25 Sep 24   +* Re: [ksh] Show command number in shell prompt2Keith Thompson
25 Sep 24   i`- Re: [ksh] Show command number in shell prompt1Kaz Kylheku
25 Sep 24   `* Re: [ksh] Show command number in shell prompt3Janis Papanagnou
26 Sep 24    `* Re: [ksh] Show command number in shell prompt2Janis Papanagnou
26 Sep 24     `- Re: [ksh] Show command number in shell prompt1Christian Weisgerber

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal