Shell Script if else
Posted
by user34104
on Super User
See other posts from Super User
or by user34104
Published on 2010-05-30T01:11:48Z
Indexed on
2010/05/30
1:12 UTC
Read the original article
Hit count: 486
shell-script
#!/bin/bash
echo "Int. a number"
read num1
echo "Int. another numer"
read num2
if ["$num1"="$num2"]; then
echo "Equals"
else
echo "Dif"
fi
if["$num1"<0]; then
echo "The number $num1 is negative"
else if ["$num2"<0]; then
echo "The number $num2 is negative"
fi
#
this code is not working, i've something wrong when i see if the number is < 0.
thanks
© Super User or respective owner