my script name is 1. when i type in "1 2012 12 12". it shows current date calendar and when i enter a invaild date like "1 2323232" cal gives me a error so how could i put that in if loop that if it gives error it echos "date is not valid"
year=$(echo "$year" | bc)
month=$(echo "$month" | bc)
day=$(echo "$day" | bc)
cal $day $month $year
if [ $? -eq 0];
then
echo "Date is valid"
else
echo "Date in not valid"
fi
calendar
usage? We've just seen almost the same piece of code here: unix.stackexchange.com/questions/159888/… – jimmij Oct 7 '14 at 23:32