Continuei recebendo esse erro quando fiz SSH em minha caixa.
-bash: /root/.bashrc: line 65: syntax error near unexpected token `elif'
-bash: /root/.bashrc: line 65: `elif [ -n "$BASH_VERSION" ]; then'
Isso é o que eu tenho nessas linhas
if [ -n "$ZSH_VERSION" ]; then
# assume Zsh
elif [ -n "$BASH_VERSION" ]; then
PS1="⚡️$yellow $dircolor \W $lightpurple $white"
if [ $USER == 'root' ]
then
export PS1="$white┌──[$red\u$white@$red\h$white]──$white[$red\w$white] \n└── $white"
else
export PS1="$white┌──[$lightgreen\u$white@$lightgreen\h$white]──$white[$lightgreen\w$white] \n└── $white"
fi
else
# assume something else
fi
Só estou verificando se zsh/bash e definindo meu PS1 de acordo.
Estou fazendo algo errado na minha sintaxe?
Responder1
Isso porque seu if
corpo está vazio. Tente adicionar uma instrução fictícia como :
, ou melhor, reescreva seu código sem testar zsh:
if [ -n "$BASH_VERSION" ]; then
PS1="⚡️$yellow $dircolor \W $lightpurple $white"
if [ $USER == 'root' ]
then
export PS1="$white┌──[$red\u$white@$red\h$white]──$white[$red\w$white] \n└── $white"
else
export PS1="$white┌──[$lightgreen\u$white@$lightgreen\h$white]──$white[$lightgreen\w$white] \n└── $white"
fi
fi