I am doing integer comparison in bash (trying to see if the user is running as root), and I found two different ways of doing it:
Double equals:
if [ $UID == 0 ]
then
fi
-eq
if [ $UID -eq 0 ]
then
fi
I understand that there's no >= or <= in bash, only -ge and -le, so why is there a ==
if there's a -eq
?
Is there a difference in the way it compares both sides?
[ $UID -eq 0 ]
, not[ $UID -eq 0]
.