Seguí recibiendo este error cuando ingresé por SSH a mi casilla.
-bash: /root/.bashrc: line 65: syntax error near unexpected token `elif'
-bash: /root/.bashrc: line 65: `elif [ -n "$BASH_VERSION" ]; then'
Esto es lo que tengo en estas líneas.
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
Solo verifico si zsh/bash y configuro mi PS1 en consecuencia.
¿Estoy haciendo algo mal en mi sintaxis?
Respuesta1
Eso es porque tu if
cuerpo está vacío. Intente agregar una instrucción ficticia como :
, o mejor, reescriba su código sin probar 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