Add a utility function to set shell options
This commit is contained in:
parent
e81f8f0227
commit
723e49488d
2 changed files with 10 additions and 0 deletions
2
src/tori
2
src/tori
|
@ -13,6 +13,8 @@ TMP_DIR="/tmp/tori"
|
||||||
argument="$1"
|
argument="$1"
|
||||||
parameter="$2"
|
parameter="$2"
|
||||||
|
|
||||||
|
set_opts -
|
||||||
|
|
||||||
## global constants
|
## global constants
|
||||||
OS="$(uname -s)"
|
OS="$(uname -s)"
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,14 @@ log() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_opts() {
|
||||||
|
sign="$1"
|
||||||
|
|
||||||
|
set "${sign}o" errexit
|
||||||
|
set "${sign}o" nounset
|
||||||
|
set "${sign}o" pipefail
|
||||||
|
}
|
||||||
|
|
||||||
prepare_directories() {
|
prepare_directories() {
|
||||||
if ! [ -d "$TMP_DIR" ]; then
|
if ! [ -d "$TMP_DIR" ]; then
|
||||||
mkdir "$TMP_DIR"
|
mkdir "$TMP_DIR"
|
||||||
|
|
Loading…
Reference in a new issue