From 9608746394d06fd318a04c123d28d48a51f0c013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9drix?= Date: Thu, 29 May 2025 07:25:13 +0200 Subject: [PATCH] =?UTF-8?q?afficher=20un=20pourcentage=20d=E2=80=99avancem?= =?UTF-8?q?ent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- local/bin/updateall.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/local/bin/updateall.sh b/local/bin/updateall.sh index 8468daf..25da37e 100755 --- a/local/bin/updateall.sh +++ b/local/bin/updateall.sh @@ -202,7 +202,16 @@ echo -e "\n--- Démarrage du traitement ---\n" # Parcourir la liste des machines +total=${#machines[@]} +current=0 + for machine in "${machines[@]}"; do + + ((current++)) + percent=$(( current * 100 / total )) + bar=$(printf "%-${total}s" "#" | cut -c 1-$current) + echo -ne "[${percent}%] [${bar}] $machine ($current/$total)\n" + # Vérification si le nom de machine est présent dans le fichier .config/updateall-hosts echo -e "\n" echo -n " >> $machine "