Add a utility function to set shell options

This commit is contained in:
Juno Takano 2024-07-07 16:15:44 -03:00
parent e81f8f0227
commit 723e49488d
2 changed files with 10 additions and 0 deletions

View file

@ -13,6 +13,8 @@ TMP_DIR="/tmp/tori"
argument="$1"
parameter="$2"
set_opts -
## global constants
OS="$(uname -s)"

View file

@ -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"