Which symbol is used for setting the PS1 prompt to show the current event number?

Nguyễn Pháp

New member
Which symbol is used for setting the PS1 prompt to show the current event number?
A. ^
B. !
C. &
D. |
 
Answer: b
Explanation: Bash and Korn shell also supports history facility that treats a previous command as an event and associates it with a number. Thus we can recall and execute previous commands by their event numbers. Using the !, we can set the PS1 prompt to show the current event number. For example,
Code:
$ PS1=’ [!] ’        //bash requires \ before !
[42] _              // number associated 
Every time a command is executed, the event number is incremented.
 

Tìm kiếm

Back
Top