Article 4ZP21 what is the difference between "0" and "5 - 5" in bash scripts

what is the difference between "0" and "5 - 5" in bash scripts

by
skyworld_chen
from LinuxQuestions.org on (#4ZP21)
Hi,
I'm learning bash and checked these code:
Code:if [ 0 ]
then
echo "0 is true"
else
echo "0 is false"
fi

if [ expr 5 - 5 ]
then
echo "5 - 5 is true"
else
echo "5 - 5 is false"
fiI got this from CentOS 7 output:
Quote:
./test1.sh
0 is true
./test1.sh: line 19: [: too many arguments
5 - 5 is false
I'm confused here: Why the first result is true while the second result is false? Thanks.latest?d=yIl2AUoC8zA latest?i=kx4mnDU76z0:Tf_6VY41CRU:F7zBnMy latest?i=kx4mnDU76z0:Tf_6VY41CRU:V_sGLiP latest?d=qj6IDK7rITs latest?i=kx4mnDU76z0:Tf_6VY41CRU:gIN9vFwkx4mnDU76z0
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments