23,215
社区成员




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 鈥樷€?[1m\s-\v\$ 鈥欌€?
PS2 The value of this parameter is expanded as with PS1 and used as the secondary prompt string. The
default is 鈥樷€?[1m> 鈥欌€?
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 multiple times, as neces-
sary, to indicate multiple levels of indirection. The default is 鈥樷€?[1m+ 鈥欌€?
\d :代表日期,格式为weekday month date,例如:"Mon Aug 1"
\H :完整的主机名称。例如:我的机器名称为:fc4.linux,则这个名称就是fc4.linux
\h :仅取主机的第一个名字,如上例,则为fc4,.linux则被省略
\t :显示时间为24小时格式,如:HH:MM:SS
\T :显示时间为12小时格式
\A :显示时间为24小时格式:HH:MM
\u :当前用户的账号名称
\v :BASH的版本信息
\w :完整的工作目录名称。家目录会以 ~代替
\W :利用basename取得工作目录名称,所以只会列出最后一个目录
\# :下达的第几个命令
\$ :提示字符,如果是root时,提示符为:# ,普通用户则为:$