2016-07-24 15 views
1

このエラーの解決方法はわかりませんでした。ここで.bashrc:構文エラー:予期しないファイルの末尾

bash: /home/dery/.bashrc: line 168: syntax error: unexpected end of file

は私.bashrc次のとおりです。

case $- in 
    *i*) ;; 
     *) return;; 
esac 

HISTCONTROL=ignoreboth 

shopt -s histappend 

HISTSIZE=1000 
HISTFILESIZE=2000 

shopt -s checkwinsize 

[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" 

if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then 
    debian_chroot=$(cat /etc/debian_chroot) 
fi 

case "$TERM" in 
    xterm-color) color_prompt=yes;; 
esac 

if [ -n "$force_color_prompt" ]; then 
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then 
     color_prompt=yes 
    else 
     color_prompt= 
    fi 
fi 

if [ "$color_prompt" = yes ]; then 
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\[email protected]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' 
else 
    PS1='${debian_chroot:+($debian_chroot)}\[email protected]\h:\w\$ ' 
fi 
unset color_prompt force_color_prompt 

if [ -x /usr/bin/dircolors ]; then 
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" 
    alias ls='ls --color=auto' 
    alias grep='grep --color=auto' 
    alias fgrep='fgrep --color=auto' 
    alias egrep='egrep --color=auto' 
fi 

alias ll='ls -alF' 
alias la='ls -A' 
alias l='ls -CF' 

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$//'\'')"' 

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

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 

case "$TERM" in 
xterm*|rxvt*) 
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\$(print_title)\a\]$PS1" 
    __el_LAST_EXECUTED_COMMAND="" 
    print_title() 
    { 
     __el_FIRSTPART="" 
     __el_SECONDPART="" 
     if [ "$PWD" == "$HOME" ]; then 
      __el_FIRSTPART=$(gettext --domain="pantheon-files" "Home") 
     else 
      if [ "$PWD" == "/" ]; then 
       __el_FIRSTPART="/" 
      else 
       __el_FIRSTPART="${PWD##*/}" 
      fi 
     fi 
     if [[ "$__el_LAST_EXECUTED_COMMAND" == "" ]]; then 
      echo "$__el_FIRSTPART" 
      return 
     fi 
     #trim the command to the first segment and strip sudo 
     if [[ "$__el_LAST_EXECUTED_COMMAND" == sudo* ]]; then 
      __el_SECONDPART="${__el_LAST_EXECUTED_COMMAND:5}" 
      __el_SECONDPART="${__el_SECONDPART%% *}" 
     else 
      __el_SECONDPART="${__el_LAST_EXECUTED_COMMAND%% *}" 
     fi 
     printf "%s: %s" "$__el_FIRSTPART" "$__el_SECONDPART" 
    } 
    put_title() 
    { 
     __el_LAST_EXECUTED_COMMAND="${BASH_COMMAND}" 
     printf "\033]0;%s\007" "$1" 
    } 

    # Show the currently running command in the terminal title: 
    # http://www.davidpashley.com/articles/xterm-titles-with-bash.html 
    update_tab_command() 
    { 
     # catch blacklisted commands and nested escapes 
     case "$BASH_COMMAND" in 
      *\033]0*|update_*|echo*|printf*|clear*|cd*) 
      __el_LAST_EXECUTED_COMMAND="" 
       ;; 
      *) 
      put_title "${BASH_COMMAND}" 
      ;; 
     esac 
    } 
    preexec_functions+=(update_tab_command) 
    ;; 
*) 
    ;; 
+1

「esac」、「fi」、「done」などを入力するのを忘れたときに、通常は「unexpected end of file」というエラーが表示されます。このようなエラーを検出するには、スクリプトを[shellcheck](http://shellcheck.net)でチェックしてください。 –

答えて

3

あなたはesacで、スクリプトの終了時に、あなたのcaseを閉じるのを忘れていました。これにより、末尾にはcaseが残され、Bashはファイルの最後に到達し、このエラーを引き起こします。

関連する問題