Comment on Tutorial - Check for leap year in Shell Script By Vivek G



Comment Added by : notnooblikeyou

Comment Added at : 2013-01-29 15:11:30

Comment on Tutorial : Check for leap year in Shell Script By Vivek G
this is WRONG!

your IF should be:

if [[ $(($year % 4)) == 0 && $(($year % 100)) != 0 ]] || [ $(($year % 400)) == 0 ]

that's a working script:

#!/bin/bash

read year

if [[ $(($year % 4)) == 0 && $(($year % 100)) != 0 ]] || [ $(($year % 400)) == 0 ]
then
echo "leap"
exit
fi

echo "not leap";


View Tutorial



Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. Very Nice Explanation.
View Tutorial          By: Anuj Bansal at 2012-08-25 12:23:59

2. In the case of Basic validation is it must to spec
View Tutorial          By: Uma shankar at 2014-07-09 00:58:05

3. Hi!
I would like to send a string from a j2

View Tutorial          By: beetlebrain at 2010-03-26 06:02:00

4. i have to retrieve data from database which is on
View Tutorial          By: abhishek at 2012-04-05 05:04:01

5. thank you very much....
View Tutorial          By: divya at 2013-01-06 15:50:43

6. Hi Chandra, you will have to download the winrar t
View Tutorial          By: Ramlak at 2008-08-08 00:14:40

7. Hi,

I alos faced the same problem o

View Tutorial          By: prasanna kumar v at 2010-05-15 02:55:59

8. Hi,

This is very nice tutorial to

View Tutorial          By: Robvandam at 2010-05-03 00:29:38

9. super explanation
View Tutorial          By: pree at 2013-12-30 16:41:32

10. A good short article on Struts. Require a step by
View Tutorial          By: Atul Saxena at 2012-01-09 19:56:59