Chris Bannister wrote: > Asking on list, as others may be interested also. > > Martin Steigerwald wrote: > > martin@merkaba:~#1> > > martin@merkaba:~#130> > ^^^^^^^^^^^^^^^^^^^^^^^ > > I am wondering what is the significance of the "#1>" and the "#130>" in > your shell prompt, is that a function of the shell you are using or is > it a custom prompt? What? You have never used a paper terminal or teletype? :-) I am not Martin but let me guess since those used to be quite common in prompts. At one time almost everyone had a numbered prompt. In the old days of csh and paper printing terminals it was very common to put the command number in the prompt. Output was printed on an long fan-fold of green bar tractor feed paper. It never changed after it was printed and so referring to any particular command by number was convenient. It was very easy to refer to the previous spool of printed paper output and select a previous command and execute it again. Type in "!42" to execute command 42 again. But only if you had the commands numbered for later reference. This dates from the days before CRTs and before WYSIWYG command line editing. Here is part of the documentation from 'man csh': ... we can refer to previous events by event number ‘!11’, relatively as in ‘!-2’ (referring to the same event), by a prefix of a command word as in ‘!d’ for event 12 or ‘!wri’ for event 9, or by a string contained in a word in the command as in ‘!?mic?’ also referring to event 9. These forms, without further change, simply reintroduce the words of the specified events, each separated by a single blank. As a special case, ‘!!’ refers to the previous command; thus ‘!!’ alone is a redo. The commands are shown with their event numbers. It is not usually necessary to use event numbers, but the current event number can be made part of the prompt by placing a ‘!’ in the prompt string. And so the tradition has continued into the modern age. Bash incorporates most of the featurse of csh and allows you to do the same thing and to put the same event number into the prompt. And you can use csh event history expansion in bash the same as csh too. From the bash man page: \! the history number of this command ... ! Start a history substitution, except when followed by a blank, newline, carriage return, = or ( (when the extglob shell option is enabled using the shopt builtin). !n Refer to command line n. And so the same csh capability still exists today. I don't find it as useful on editable terminals such as an LCD. But in the old days of printing paper terminals you could look back in your history on the paper and not only pull forward !n to run the n'th command that was plainly written on the page but also you could pull forward arguments from separate previous commands and perform sed-like substitution editing on them. It was all quite efficient. And painful. These days I use and recommand WYSIWYG editing of the command line. It is less surprising. But read up on the "HISTORY EXPANSION" section of the bash man page for all of the current capabilities. It is still fun to play with even these days. I doubt Martin is actually doing it because of paper terminals. But probably just because he likes them there. But that is the history of it just the same and everyone used to have numbers in their prompts 'back in the day. Here is a small sampling of examples. 1 % echo one two three one two three 2 % echo !1 one two three 3 % echo !1:3 three 4 % echo !1:3:s/three/THREE/ THREE 5 % echo !1:1 !4:$ one THREE 6 % vi main.c 7 % cc -o myprog -g main.c 8 % !vi 9 % !cc 10 % !vi 11 % !cc -lm 12 % !vi 13 % !cc 14 % !vi ... 117 % !cc 118 % ./myprog 119 % !vi ... :-) Bob P.S. What I find most surprising is that you can still buy green bar tractor feed continuous computer paper. There must still be some of those in use! Wow.
Attachment:
signature.asc
Description: Digital signature