启动错误(第 119 行和第 121 行)Ubuntu

启动错误(第 119 行和第 121 行)Ubuntu

我在登录 Ubuntu(通过 XQuartz)时遇到启动错误。我是新手,还不知道如何修复此问题。我尝试寻找解决方案,但到目前为止没有任何结果。
您有什么建议吗?

我收到的错误如下:

-bash: /home/ubuntu/.bashrc: line 119: unexpected EOF while looking for matching `"'

-bash: /home/ubuntu/.bashrc: line 121: syntax error: unexpected end of file

输出grep -n '"' .bashrc

26:# If set, the pattern "**" used in a pathname expansion context will
31:[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
34:if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
38:# set a fancy prompt (non-color, unless we know we "want" color)
39:case "$TERM" in
48:if [ -n "$force_color_prompt" ]; then
59:if [ "$color_prompt" = yes ]; then
67:case "$TERM" in
69:    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
77:    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval 
"$(dircolors -b)"
95:# Add an "alert" alias for long running commands.  Use like so:
97:alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || 
echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0- 
9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
119:export PATH="$PATH:~/.local/bin

答案1

看起来您"在第 119 行附近有一个未终止的“ ”,当您到达脚本末尾时它仍然未终止。仔细检查第 119 行附近的行,并确保"s 的数量为偶数。

当我收到此类错误时,我会

grep -n '"' .bashrc

答案2

"从您的输出来看,第 119 行末尾似乎缺少 。使用任一方法都可以"

  • 使用文本编辑器(如 nano、gedit 或 pico)打开 .bashrc,并"在第 119 行末尾添加。
  • 或者直接运行:

    sed -i '119s/$/"/' .bashrc
    

相关内容