PROMPT_COMMAND
If set, the value is executed as a command prior to issuing each
primary prompt.
PS1 The value of this parameter is expanded (see PROMPTING below)
and used as the primary prompt string. The default value is
‘‘\s-\v\$ ’’.
PS2 The value of this parameter is expanded as with PS1 and used as
the secondary prompt string. The default is ‘‘> ’’.
PS3 The value of this parameter is used as the prompt for the select
command (see SHELL GRAMMAR above).
PS4 The value of this parameter is expanded as with PS1 and the
value is printed before each command bash displays during an
execution trace. The first character of PS4 is replicated mul-
tiple times, as necessary, to indicate multiple levels of indi-
rection. The default is ‘‘+ ’’.
shampoo 于 2009-12-08 20:13:06发表:
很惊讶bash竟然有了PS3与PS4。
一般人只需要PS1就行啦!其目的就是提醒自己目前所打开的shell是在某些状态,例如,PWD,USER,HOST等等。
早期的UNIX用户做任何事情都必须启动一个xterm,因此PS1便相当需要。
现在的KDE已经把Linux包装得与MS windows一摸一样,用户根本没有机会使用xterm,PSn自然就省啦!
alick 于 2009-12-08 18:19:46发表:
哦谢谢~
其实PSn都是提示符,提示上一命令已经执行完毕可以输入下一个命令了。里面的n表示层次。
下面的内容出自bash的手册页(LZ可以自己man bash看一下):
shampoo 于 2009-12-08 13:50:20发表:
懒得试试,猜测应该是如此:
$ PS1=smile
smile
smile pwd
/home/myuser
smile
shampoo 于 2009-12-08 13:46:28发表:
呵呵,我的神秘微笑被你拆穿啦!
十年前我写的一本UNIX书,里面是如此写滴:
PS1,第一个呼应字串,(设定为“$ ”)
PS2,第二个呼应字串,(设定为“> ”)
所以,你的答案正确!拍拍手。
alick 于 2009-12-08 12:45:26发表:
连接ftp时就能看到PS2了,默认的是>
shampoo 于 2009-12-07 15:05:36发表:
很久没玩这咚咚啦!
试试:
PS=cry
echo $PS
PS1=smile
echo $PS1
yanhuinianmo 于 2009-12-07 14:45:05发表:
你送我个答案不更好,嘿嘿
shampoo 于 2009-12-07 14:17:01发表:
呵呵,送你一个神秘的微笑。