.bashrc中错误的bash:/home/jason/.bashrc:行115:语法错误:意外的文件结束 [英] .bashrc error bash: /home/jason/.bashrc: line 115: syntax error: unexpected end of file

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

问题描述

下面是当我开始一个新的终端出现在屏幕顶部的错误:

Here is the error that appears at the top of the screen when I start a new terminal:

庆典:/home/jason/.bashrc:行115:语法错误:意外的文件结尾

bash: /home/jason/.bashrc: line 115: syntax error: unexpected end of file

我去说文件,并试图注释掉以下行(这code的最后一行是线路115)code的这解决了一个很草率的方式问题:

I went to said file and and tried commenting out the following lines (The final line of this code is line 115.) of code which solved the problem in a very sloppy way:

#if ! shopt -oq posix; then
  #if [ -f /usr/share/bash-completion/bash_completion ]; then
    #. /usr/share/bash-completion/bash_completion
  #elif [ -f /etc/bash_completion ]; then
    #. /etc/bash_completion
  #fi
#fi

我不熟悉这个code,并且将AP preciate的解决方案,或者对如何更好地格式化这个问题,甚至建议。

I am not familiar with this code, and would appreciate a solution, or even a suggestion on how to format this question better.

推荐答案

原来,当我走进我的.bash_aliases文件,并通过一块注释掉一块我别名以下别名是罪魁祸首。

Turns out when I went into my .bash_aliases file and commented out piece by piece my aliases the following alias was the culprit.

alias fi='firefox'

究其原因,这是错误的,因为网络是,如果语句的结束,而这个走进bash脚本的方式它读作结束,如果,而不是期望的别名。导致错误。

The reason this is faulty is because fi is the end of an if statement, and the way this went into bash script it was read as ending the if, rather than as the name of the desired alias. Resulting in a error.

她是固定线。

alias fir='firefox'

这个故事的寓意是因为它在bash脚本读取为结束if语句不使用网络别名。

Moral of the story is don't use fi as an alias because it is read as the end to an if statement in bash script.

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

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