Blepete kapoio lathos

Fanurgakis Manolis mfano at freemail.gr
Sat Oct 25 00:27:04 EEST 2003


On Friday 24 October 2003 22:26, Alaios wrote:
> Kalispera mporeite na mou peite ti lathos kano?
>
> a= expr `date +%d` % 5
> echo $a
> if [ "$a" =  "0" ]
> then
> 	echo "doylepse"
> else
> 	echo "den doylepse"
> fi
>
> Thelo me ton parapano kodika otan yparxei mera pou na
> teleionei se 5 (5,15,25) na grafei doulepse... Opos
> blepo den bgainei i synthiki sto if. Mporei diladi to
> echo $a na bgazei 0 , alla i synthiki to blepei kapos
> allios. Kammia idea?

Άλλη παρατήρηση:

Τo (n mod 5)=0 μας δίνει όλα τα πολλαπλάσια του 5 και όχι τα 5,15,25 που 
θέλεις.

Για τα 5,15,25 θέλεις τον τύπο:

[(n-5) mod 10] = 0

Δηλαδή:

d=`date +%d`
a=`expr $((d-5)) % 10`




More information about the Migrate2linux mailing list