All New

user:thomas gists created by user

title:mygist gists with given title

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

Register

Login


All New Register Login

All gists matching topic trap

Recently created
Least recently created
Recently updated
Least recently updated
nithir's Avatar

nithir / capturer les erreurs d'un shell

0 likes
0 forks
2 files
Last active 1748861876
permet de récupérer la ligne en erreur et la commande executer
bash script shell trap
1 #!/usr/bin/env bash
2 set -euo pipefail
3
4 # Set a trap to handle errors and log them.
5 trap 'echo "Error occurred at line $LINENO. Command: $BASH_COMMAND"' ERR
6 # https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html#index-LINENO
7
8 false
nithir's Avatar

nithir / Utilisation de la commande trap

0 likes
0 forks
1 files
Last active 1748863705
bash script shell trap
1 # trap "systemctl restart $SERVICES" INT QUIT TERM KILL EXIT
2
3 # la commande trap va capturer:
4
5 # INT, les interruptions volontaire
6 # QUIT, ne semble pas faire son boulot
7 # TERM, je ne sais plus
8 # KILL, capture les signal d'interruption
9 # EXIT, semble faire le boulot de QUIT
Newer Older

Powered by Opengist ⋅ Load: 49ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文