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'
Vivek
13.6k19 gold badges101 silver badges139 bronze badges
1 Answer 1
The correct code:
if [ $USER == "root" ]; then echo "hi; else echo "bye"; fi
answered Dec 8, 2015 at 6:54
1 Comment
123
==
is the same as =
lang-bash
else
andfi
? or just don't force all that poor code into one line. or if it's really just that small snippet consider using&&
and||
instead.