bash: .bashrc: 行 148: 構文エラー: 予期しないファイルの終了

bash: .bashrc: 行 148: 構文エラー: 予期しないファイルの終了

でパスを設定する必要がありました.bashrc。 を使用して開いたところvi .bashrc、誤って最後の行 ( を含むものfi) を省略し、パスを追加しました。 を使用して保存しました:wq。 実行中は、次のsource .bashrcように表示されます。

bash: .bashrc: line 148: syntax error: unexpected end of file.

これらは次の最後の行です~/.bashrc:

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
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
PATH=$PATH:/home/rbh/PROGRAMS.330/bin 
export PATH

答え1

あなたの.bashrc見た目は次のようになるはずです

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
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

PATH=$PATH:/home/rbh/PROGRAMS.330/bin export PATH

fi最後にifブロックの条件を閉じる部分を削除しました

関連情報