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



Subscribe to Tutorials

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. What is transient keyword in Java?


View Tutorial          By: Mohit at 2010-11-18 00:26:24

2. Having this error while using comm.jsr for sending
View Tutorial          By: Amit Kumar at 2013-10-15 09:04:58

3. The Compleate Reference
JAVA Seventh Editi

View Tutorial          By: joshap at 2014-10-25 12:05:41

4. thank you for code
View Tutorial          By: turki at 2013-12-11 13:23:44

5. i need help in java
View Tutorial          By: arjun tanwar at 2010-02-17 20:58:55

6. plz send me java prograams
View Tutorial          By: simmy at 2009-10-26 01:57:55

7. we generally use this keyword for referring to the
View Tutorial          By: madhu at 2012-02-07 14:11:57

8. this is the best example of method overriding but
View Tutorial          By: Dipesh at 2009-09-09 12:52:21

9. as we write:
ob1.t.join();
Does t

View Tutorial          By: abc123 at 2011-04-03 13:33:33

10. I like this tutorial, it is self explaining. good
View Tutorial          By: Nikia at 2013-01-25 20:04:30