Set additional bash options and group together
This commit is contained in:
parent
3563e39bdc
commit
099dd66488
10
install.sh
10
install.sh
@ -1,8 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
set -o pipefail
|
||||
|
||||
# Setup script environment
|
||||
set -o errexit #Exit immediately if a pipeline returns a non-zero status
|
||||
set -o errtrace #Trap ERR from shell functions, command substitutions, and commands from subshell
|
||||
set -o nounset #Treat unset variables as an error
|
||||
set -o pipefail #Pipe will exit with last non-zero status if applicable
|
||||
shopt -s expand_aliases
|
||||
alias die='EXIT=$? LINE=$LINENO error_exit'
|
||||
trap die ERR
|
||||
trap cleanup EXIT
|
||||
|
||||
function error_exit() {
|
||||
REASON=$1
|
||||
MSG="\e[91mERROR: \e[93m$EXIT@"
|
||||
@ -19,7 +26,6 @@ function cleanup() {
|
||||
popd >/dev/null
|
||||
rm -rf $TMP
|
||||
}
|
||||
trap cleanup EXIT
|
||||
TMP=`mktemp -d`
|
||||
pushd $TMP >/dev/null
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user