Output errors to stderr

This commit is contained in:
the-sane 2021-01-15 20:42:47 -05:00 committed by GitHub
parent 82c5ccbbab
commit 37762b9075
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,7 +41,7 @@
# Check for dependencies # Check for dependencies
if [ ! -x "$(command -v mktemp)" ] || [ ! -x "$(command -v basename)" ]; then if [ ! -x "$(command -v mktemp)" ] || [ ! -x "$(command -v basename)" ]; then
echo -e "One or more required packages were not found on this system.\nPlease check that the following packages are installed:\n- mktemp (part of gnu coreutils)\n- basename (part of gnu coreutils)" echo -e "lug-helper.sh: One or more required packages were not found on this system.\nPlease check that the following packages are installed:\n- mktemp (part of gnu coreutils)\n- basename (part of gnu coreutils)" 1>&2
exit 1 exit 1
fi fi
@ -114,12 +114,13 @@ debug_echo() {
echo -e "\n$2\n" echo -e "\n$2\n"
;; ;;
"exit") "exit")
echo -e "\n$2" # Write an error to stderr and exit
echo -e "lug-helper.sh: $2" 1>&2
read -n 1 -s -p "Press any key..." read -n 1 -s -p "Press any key..."
exit 0 exit 1
;; ;;
*) *)
echo -e "\nScript error: Unknown argument provided to debug_echo function. Aborting." echo -e "lug-helper.sh: Unknown argument provided to debug_echo function. Aborting." 1>&2
read -n 1 -s -p "Press any key..." read -n 1 -s -p "Press any key..."
exit 0 exit 0
;; ;;