#!/bin/bash # $1 : NOM-COTISANT # $2 : STATUT-COTISANT # $3 : ADRESSE-COTISANT # $4 : SOMME # $5 : DATE-VERSEMENT # $6 : MODE-VERSEMENT # $7 : ANNEE-CIVILE set -e #exec {BASH_XTRACEFD}> >(tail -n 1) # send set -x output to tail -n 1 #PS4=':At line $LINENO; prior command exit status $?+' #set -x if [ $# -ne 7 ]; then echo "Nombre d'arguments incorrect" exit 1 fi FILE=$(echo $1 | tr " " "_")_reçu_$(echo $5 | tr "/" ".").tex NOM_COTISANT=$(echo $1 | tr "/" ".") STATUT_COTISANT=$(echo $2 | tr "/" ".") ADRESSE_COTISANT=$(echo $3 | tr "/" ".") SOMME=$(echo $4 | tr "/" ".") DATE_VERSEMENT=$(date -d$5 +%d/%m/%Y) MODE_VERSEMENT=$(echo $6 | tr "/" ".") ANNEE_CIVILE=$(echo $7) cat RECU_COTISATION.tex > "$FILE" sed -i "s/ANNEE-CIVILE/$ANNEE_CIVILE/" "$FILE" sed -i "s/NOM-COTISANT/$NOM_COTISANT/" "$FILE" sed -i "s/STATUT-COTISANT/$STATUT_COTISANT/" "$FILE" sed -i "s/ADRESSE-COTISANT/$ADRESSE_COTISANT/" "$FILE" sed -i "s/SOMME/$SOMME/" "$FILE" sed -i "s|DATE-VERSEMENT|$DATE_VERSEMENT|" "$FILE" sed -i "s/MODE-VERSEMENT/$MODE_VERSEMENT/" "$FILE" pdflatex "$FILE" rm -f *.aux *.log