bash - My shell script for checking leap year is showing error -
#!/bin/bash echo "enter year (yyyy)" read year if[ $((year % 4)) -eq 0] if[ $((year % 100)) -eq 0] if[ $((year % 400)) -eq 0] echo "its leap year" else echo "its not leap year" fi else echo "its not leap year" fi else echo "its not leap year" fi
its showing error on 7th line , on
[ $((year % 4)) -eq 0]
you miss blanks nesessary in bash:
echo "enter year (yyyy)" read year if [ $((year % 4)) -eq 0 ] if [ $((year % 100)) -eq 0 ] if [ $((year % 400)) -eq 0 ] echo "its leap year" else echo "its not leap year" fi else echo "its not leap year" fi else echo "its not leap year" fi
Comments
Post a Comment