- Code: Select all
if [ "`expr $VALUE1 + $VALUE2`" -eq "11" ]; then
echo "Can you say the number $VALUE1"
else if [ "$VALUE2" -lt "$VALUE3" ]; then
echo "What's sup."
echo "Not Valid"
Okay, so I am learning Bash scripting, so every now and then I make small scripts so that eventually I can use them proficiently and one day aplly them to real life. This script is me playing around with loops, as it is what I am trying to learn at the moment. There is no actual purpose of the script other than to demonstrate a loop (not finished yet) What is suppose to happen is the first condition is not suppose to be met (this is intended), so it should automatically go to the second condition which is true. Also, if none of the above condition would be met, then the prompt will echo "not valid" However, it won't go through all the way. It keeps producing an error. Obviously I made a mistake somewhere along the way, and I can't figure it out. Could someone help me identify my mistake, and give me a solution? Thanks
Anyway, I'm suppose to be playing around with this script and experimenting with different options. I'd like to get if - then statements down patch.