且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

.bash_profile语法错误:文件意外结束

更新时间: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}$ "
}