更新时间:2022-06-08 21:27:50
此行:
precmd () { PS1="${ORANGE}[%~] ${GREEN}$(prompt_ruby_info) ${NORMAL}$ " }
在末尾缺少分号:
precmd () { PS1="${ORANGE}[%~] ${GREEN}$(prompt_ruby_info) ${NORMAL}$ " ; }
从Bash参考手册中:
From the Bash reference manual :
{列表; }
{ list; }
在花括号之间放置命令列表会导致 在当前shell上下文中要执行的列表.没有子shell 创建.以下是分号(或换行符).
Placing a list of commands between curly braces causes the list to be executed in the current shell context. No subshell is created. The semicolon (or newline) following list is required.
这意味着您还可以编写:
This means you could also write :
precmd ()
{
PS1="${ORANGE}[%~] ${GREEN}$(prompt_ruby_info) ${NORMAL}$ "
}