シェルスクリプト - 予期しない表示「[」の近くに構文エラーがあります。

シェルスクリプト - 予期しない表示「[」の近くに構文エラーがあります。

端末を開くと、次のエラーが発生します。

bash: /home/ai/.bashrc: line 75: syntax error near unexpected token `['
bash: /home/ai/.bashrc: line 75: `if [ -x /usr/bin/dircolors ]; then'

コメントで始まるbashrcファイルスクリプトの関連部分は次のとおりです。

# enable color support of ls and also add handy aliases

if [ -x /usr/bin/dircolors ]; then

    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'

fi

私は何が間違っていて、どのように解決できますか?

ベストアンサー1

Pastebinリンクを見ると、問題のあるブロックの前にesac終わるステートメントがありません。case

おすすめ記事