From 723e49488deff840a0df63a0e1a77a225ab8630f Mon Sep 17 00:00:00 2001 From: jutty Date: Sun, 7 Jul 2024 16:15:44 -0300 Subject: [PATCH] Add a utility function to set shell options --- src/tori | 2 ++ src/utility.sh | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/src/tori b/src/tori index 05501a7..a025a5d 100755 --- a/src/tori +++ b/src/tori @@ -13,6 +13,8 @@ TMP_DIR="/tmp/tori" argument="$1" parameter="$2" +set_opts - + ## global constants OS="$(uname -s)" diff --git a/src/utility.sh b/src/utility.sh index cfd0e14..d280751 100644 --- a/src/utility.sh +++ b/src/utility.sh @@ -13,6 +13,14 @@ log() { fi } +set_opts() { + sign="$1" + + set "${sign}o" errexit + set "${sign}o" nounset + set "${sign}o" pipefail +} + prepare_directories() { if ! [ -d "$TMP_DIR" ]; then mkdir "$TMP_DIR"