简体   繁体   English

bash脚本错误意外的令牌错误

[英]bash script error unexpected token error

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

it is giving me the following error 它给我以下错误

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM