.bash_profile语法错误:文件意外结束 [英] .bash_profile syntax error: unexpected end of file

查看:358
本文介绍了.bash_profile语法错误:文件意外结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OS:macOS Sierra v10.12.2

OS: macOS Sierra v10.12.2

我试图让R在命令行上运行并遇到这个问题,可能是因为我对编码还比较陌生,并且搞不懂一些本不应该的东西.

I was trying to get R working from the command line and ran into this problem, probably because I am relatively new to coding and messed with something I should not have.

在打开新终端时:

-bash: /Users/Brad/.bash_profile: line 33: syntax error: unexpected end of file

当我检查配置文件时,它看起来像这样:

When I inspect the profile it looks like this:

# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH

# Setting PATH for Python 3.5
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH

export PATH="$HOME/.bin:$PATH"

eval "$(hub alias -s)"

  prompt_ruby_info() {
    if [ -f ".ruby-version" ]; then
      cat .ruby-version
    fi
  }

GREEN=$(tput setaf 65)

ORANGE=$(tput setaf 166)

NORMAL=$(tput sgr0)

precmd () { PS1="${ORANGE}[%~] ${GREEN}$(prompt_ruby_info) ${NORMAL}$ " }

export CLICOLOR=1;

export LSCOLORS=Gxfxcxdxbxegedabagacad;

任何有关如何解决此问题的信息将不胜感激;我不想让事情变得更糟!

Any information on how to resolve this issue would be much appreciated; I don't want to keep messing around and making it worse!

谢谢!

推荐答案

此行:

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}$ "
}

这篇关于.bash_profile语法错误:文件意外结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆