My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# ----------------------------------------------------------------------------
# Diz se o ano informado é bissexto ou não.
# Obs.: Se o ano não for informado, usa o atual.
# Uso: zzbissexto [ano]
# Ex.: zzbissexto
# zzbissexto 2000
#
# Autor: Aurelio Marinho Jargas, www.aurelio.net
# Desde: 2011-05-21
# Versão: 1
# Licença: GPL
# Tags: data
# ----------------------------------------------------------------------------
zzbissexto ()
{
zzzz -h bissexto "$1" && return

local ano="$1"

# Se o ano não for informado, usa o atual
test -z "$ano" && ano=$(date +%Y)

# Validação
zztool -e testa_ano "$ano" || return 1

if zztool testa_ano_bissexto "$ano"
then
echo "$ano é bissexto"
else
echo "$ano não é bissexto"
fi
}

Change log

r710 by aureliojargas on Mar 29, 2012   Diff
SEGURANÇA: $1 colocado entre aspas na
chamada padrão zzzz -h de todas as
funções.
Go to: 
Sign in to write a code review

Older revisions

r709 by aureliojargas on Mar 29, 2012   Diff
SEGURANÇA: aspas ao redor de
variáveis.
r655 by aureliojargas on Mar 23, 2012   Diff
s/Aurélio/Aurelio/ *
r515 by aureliojargas on May 21, 2011   Diff
Função nova zzbissexto - Diz se o ano
informado é bissexto ou não. Testador
atualizado.
All revisions of this file

File info

Size: 747 bytes, 32 lines
Powered by Google Project Hosting