bash脚本错误意外令牌错误

时间:2015-12-08 06:46:51

标签: bash shell

if [ $USER=root ]; then     echo "hi" else  echo "bye" fi

它给了我以下错误

line 5: syntax error near unexpected token `fi'
line 5: `fi'

1 个答案:

答案 0 :(得分:1)

正确的代码: if [ $USER == "root" ]; then echo "hi; else echo "bye"; fi