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

fiif 블록 조건을 닫는 마지막 항목을 삭제했습니다.

관련 정보