How "Exit Traps" Can Make Your Bash Scripts Way More Robust And Reliable
jeudi 26 novembre 2015 à 12:12@jeekajoo links
"""
#!/bin/bash
function finish {
# Your cleanup code here
}
trap finish EXIT
"""
Faire exécuter une fonction à la fin d'un script bash, quelque soit son issue.
C'est pratique pour faire le nettoyage nécessaire, en particulier quand on fait du "fail-fast" (https://jeekajoo.eu/links/?DRhD6w).
(Permalink) (Profil)
"""
#!/bin/bash
function finish {
# Your cleanup code here
}
trap finish EXIT
"""
Faire exécuter une fonction à la fin d'un script bash, quelque soit son issue.
C'est pratique pour faire le nettoyage nécessaire, en particulier quand on fait du "fail-fast" (https://jeekajoo.eu/links/?DRhD6w).
(Permalink) (Profil)