I'm new to bash scripting and I don't understand what's wrong with this specific part of my script. im trying to select all the exit that have in my script. and trying to put in conditon that if all those condition is not met then its not valid and else its valid.
if [[ `echo $?` -ne {0..4} ]]
then
echo "Its a Valid Date."
else
echo " Not valid date."
fi
When I run it, I get:
kpatel138@matrix:~/Lab2> ./cal2 1994 5 4
./cal2: line 40: unexpected argument `(' to conditional binary operator
./cal2: line 40: syntax error near `(0'
./cal2: line 40: `if [[ `echo $?` -ne (0..4) ]]'
{0..4}
or(0..4)
(braces and parentheses are not the same). Also, BTW, you can probably change`echo $?`
to just plain$?
. – G-Man Says 'Reinstate Monica' Oct 9 '14 at 17:52