Last change
on this file since 2 was
2,
checked in by pinsard, 15 years ago
|
first commit with original work of Francoise Pinsard
|
-
Property svn:executable set to
*
-
Property svn:keywords set to
Id
|
File size:
952 bytes
|
Line | |
---|
1 | #! /bin/sh |
---|
2 | #+ |
---|
3 | # |
---|
4 | # NAME |
---|
5 | # ==== |
---|
6 | # |
---|
7 | # is_leap_year.sh - tell if year is leap |
---|
8 | # |
---|
9 | # SYNOPSYS |
---|
10 | # ======== |
---|
11 | # |
---|
12 | # ``is_leap_year.sh [yyyy]`` |
---|
13 | # |
---|
14 | # DESCRIPTION |
---|
15 | # =========== |
---|
16 | # |
---|
17 | # |
---|
18 | # Tell if year is leap by exit status. |
---|
19 | # |
---|
20 | # If no argument is given, current year will be used. |
---|
21 | # |
---|
22 | # EXAMPLES |
---|
23 | # ======== |
---|
24 | # |
---|
25 | # |
---|
26 | # Is 2000 leap ? |
---|
27 | # :: |
---|
28 | # |
---|
29 | # $ is_leap_year.sh 2000 |
---|
30 | # $ echo ${?} |
---|
31 | # 0 |
---|
32 | # |
---|
33 | # Is 2001 leap ? |
---|
34 | # :: |
---|
35 | # |
---|
36 | # $ is_leap_year.sh 2001 |
---|
37 | # $ echo ${?} |
---|
38 | # 1 |
---|
39 | # |
---|
40 | # FILES |
---|
41 | # ===== |
---|
42 | # |
---|
43 | # original location |
---|
44 | # ~~~~~~~~~~~~~~~~~ |
---|
45 | # |
---|
46 | # /usr/home/fplod/incas/varamma/varamma_ws/is_leap_year.sh sur aedon.locean-ipsl.upmc.fr |
---|
47 | # |
---|
48 | # EVOLUTIONS |
---|
49 | # ========== |
---|
50 | # |
---|
51 | # $Id$ |
---|
52 | # |
---|
53 | # - fplod 2008-08-05T13:21:05Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
54 | # |
---|
55 | # * creation from http://cfaj.freeshell.org/shell/tuesday-tips/#tt-2004-06-08 |
---|
56 | # |
---|
57 | #- |
---|
58 | # |
---|
59 | ily_year=${1:-`date +%Y`} |
---|
60 | [ $(( ${ily_year} % 400)) -eq 0 -o \ |
---|
61 | \( $(( ${ily_year} % 4)) -eq 0 -a \ |
---|
62 | $(( ${ily_year} % 100)) -ne 0 \) ] && { |
---|
63 | exit 0 |
---|
64 | } || { |
---|
65 | exit 1 |
---|
66 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.