#!/bin/bash
echo "Enter the year (YYYY)"
read year
if[ $((year % 4)) -eq 0]
then
if[ $((year % 100)) -eq 0]
then
if[ $((year % 400)) -eq 0]
then
echo "its a leap year"
else
echo "its not a leap year"
fi
else
echo "Its not a leap year"
fi
else
echo "its not a leap year"
fi
its showing error on 7th line and also on
[ $((year % 4)) -eq 0]
You've made it too complicated. Use this code to figure leap year:
Test it:
Test This Code:
You miss some blanks which are nesessary in bash: