#!/bin/bash #VARIABLES COULEURS RED="\033[1;31m" GREEN="\033[1;32m" END="\033[0m" echo " "; echo "Quelle année souhaitez-vous tester ?"; echo " "; read year echo " "; # INITIALISATION DES COMPTEURS i=0; y=0 # BOUCLE INCREMENTALE (compte tous les vendredis 13 de tous les mois) for (( x=1; x<=12; x+=1 )) do i=`cal $x $year | awk {'print $6'} | grep 13 | wc -l` # AFFICHE LE MOIS SI VENDREDI 13 if [[ $i = 1 ]]; then cal $x $year; fi y=$( expr $y + $i ) done case $y in 0) echo -e "\nEn "$year",on compte "$y" Vendredi 13 : "$GREEN"Année médiocre"$END"\n" && exit 0 ;; 1) echo -e "\nEn "$year",on compte "$y" Vendredi 13 : "$GREEN"Année calme"$END"\n" && exit 0 ;; 2) echo -e "\nEn "$year",on compte "$y" Vendredi 13 : "$GREEN"Année moyenne"$END"\n" && exit 0 ;; *) echo -e "\nEn "$year",on compte "$y" Vendredi 13 : "$RED"Année à forte vigilance"$END"\n" && exit 0 ;; esac