From 2df958c97fc069d2eba74591fd5a7c6c913363d8 Mon Sep 17 00:00:00 2001 From: alvinlollo Date: Thu, 30 Jan 2025 03:09:32 +0000 Subject: [PATCH] Fixed script from aborting after an error from zsh already installed --- install.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/install.sh b/install.sh index 3138998..e8f5e8a 100755 --- a/install.sh +++ b/install.sh @@ -14,6 +14,22 @@ echo ' --------------- Single Download script --------------- ' + +# Prints its arguments to stderr and exits with a non-zero value. +# +# If no arguments are given, it exits with the current value of $?. +# If arguments are given, it exits with 1. +# +# This function is intended to be used to print error messages. +die() { + local rc=$? + if (( $# > 0 )); then + printf '%s\n' "$@" >&2 + rc=1 + fi + exit "$rc" +} + # Fail on any command. set -eux pipefail