From d79f757a48adda2553513c64cfa23ab52ef94e41 Mon Sep 17 00:00:00 2001 From: Yacine31 Date: Fri, 18 Apr 2025 20:45:33 +0200 Subject: [PATCH] Simplification de la commande find pour la sortie HTML --- sh/local/check_expdp_log.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/sh/local/check_expdp_log.sh b/sh/local/check_expdp_log.sh index 18b7d0b..1eb21c4 100644 --- a/sh/local/check_expdp_log.sh +++ b/sh/local/check_expdp_log.sh @@ -17,5 +17,19 @@ fi # afficher les dernières lignes des fichiers log pour voir les les exports se sont bien déroulés echo "

Vérification des dernières lignes dans les logs :

" -find "${EXPDP_DIR}" -iname "export_*.log" \ - -exec bash -c 'echo "--- {} ---
"; head -10 "{}"; echo "
"; tail -10 "{}"; echo "
"' \; +# find "${EXPDP_DIR}" -iname "export_*.log" -exec bash -c 'echo "--- {} ---
"; head -10 "{}"; echo "
"; tail -10 "{}"; echo "
"' \; +# autre façon d'écrire la commande find : définition de la fonction d'affichage plus lisible +show_log_excerpt() { + local file="$1" + echo "--- ${file} ---" + echo "
"
+  head -10 "$file"
+  echo "
"
+  tail -10 "$file"
+  echo "
" +} +# export pour rendre la fonction accessible à bash -c +export -f show_log_excerpt + +# find appelle la fonction en lui passant $0 comme paramètre +find "${EXPDP_DIR}" -iname "export_*.log" -exec bash -c 'show_log_excerpt "$0"' {} \; \ No newline at end of file