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

Java program to get location meta data from an image

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

Archived Comments

1. i din understand
View Tutorial          By: panda at 2011-07-14 09:35:36

2. Hi mate,
When I compile the DomParserExampl

View Tutorial          By: Suresh Kumar D at 2013-06-25 07:06:19

3. Thank so much it helped me God bless :)
View Tutorial          By: Judito at 2014-06-14 06:52:18

4. Nice one for jsp learners.
View Tutorial          By: Vignesh at 2011-07-14 04:04:55

5. Hi,
I want to run a bat file, below are the

View Tutorial          By: Rajshekar at 2011-10-28 06:07:06

6. How to draw a thick circle in midlet?
View Tutorial          By: masi at 2011-12-01 11:47:00

7. I need a software to send messages to our members.
View Tutorial          By: M V Bhaktha at 2012-05-22 08:19:38

8. Good one. Clear basic concept
View Tutorial          By: Joshua at 2010-03-12 01:13:08

9. i need table example!!!...
View Tutorial          By: Sadyog at 2011-01-03 21:59:09

10. Plz show me how to use main method reccurssively p
View Tutorial          By: Jyoti Bankar at 2011-07-14 10:31:53