bash: .bashrc: Zeile 148: Syntaxfehler: unerwartetes Dateiende

bash: .bashrc: Zeile 148: Syntaxfehler: unerwartetes Dateiende

Ich musste den Pfad in festlegen .bashrc. Ich habe es mit geöffnet vi .bashrcund versehentlich die letzte Zeile ausgelassen (die etwas mit enthielt fi) und dann den Pfad hinzugefügt. Ich habe es mit gespeichert :wq. Dabei source .bashrcwird Folgendes angezeigt:

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

Dies sind die letzten Zeilen von ~/.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

Antwort1

Ihr .bashrcsolltet ungefähr so ​​aussehen

# 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

Sie haben zuletzt gelöscht fi, wodurch die Bedingung des if-Blocks geschlossen wurde

verwandte Informationen