I have a shell script as follows (taken from some lecture slides):
#/bin/sh
echo -e "enter a number:\c"
read number
if [$number -ne 2]
then
echo "Number is not equals to 2"
fi
And I'm getting a syntax error where fi is. Any idea what the problem is?
Also, what does the extra term in echo -e "enter a number:\c" means (asides from the simple fact that it asks for a number)?
EDIT: now I did
#/bin/sh
echo -e "enter a number:\c"
read number
if [ "$number" -ne 2 ]
then
echo "Number is not equals to 2"
fi
And I'm still getting the error...
Same goes for
#/bin/sh
read -p "enter a number: " number
if [ "$number" -ne 2 ]
then
echo "Number is not equals to 2"
fi
SOLVED: I've made a copying error there. Thanks for the input by the way, guys.
2it doesn't print the message.