From 998ce0f67c645edae90f0e80f425401b277bf056 Mon Sep 17 00:00:00 2001 From: Carter Grove Date: Tue, 14 Jun 2022 17:45:15 -0500 Subject: [PATCH] Possible Error Code Bug Fix Changed the way e4s-info-install.sh reports error codes. Made it an explicit variable. This was to avoid always having the error code be "1" if the condition was false. --- e4s-info-install.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/e4s-info-install.sh b/e4s-info-install.sh index 9c3b50a..7cf061b 100755 --- a/e4s-info-install.sh +++ b/e4s-info-install.sh @@ -105,10 +105,12 @@ echo echo "Copying e4s-info command to $PATHVAR" mkdir -p "$PATHVAR" -[ $? -eq 0 ] || { echo "Problems making directory: $PATHVAR. Either use \"sudo\" before command if permission was denied, check target directory for name collisions, or check the command \"mkdir\" error code: $?"; echo; exit 3; } +CHECKRET=$? +[ $CHECKRET -eq 0 ] || { echo "Problems making directory: $PATHVAR. Either use \"sudo\" before command if permission was denied, check target directory for name collisions, or check the command \"mkdir\" error code: $CHECKRET"; echo; exit 3; } echo "Directory either already exists or was created" cp -r e4s-info-command/ "$PATHVAR" -[ $? -eq 0 ] || { echo "Problems copying command. Either use \"sudo\" before command if permission was denied, check target directory for name collisions, or check the command \"cp\" error code: $?"; echo; exit 3; } +CHECKRET=$? +[ $CHECKRET -eq 0 ] || { echo "Problems copying command. Either use \"sudo\" before command if permission was denied, check target directory for name collisions, or check the command \"cp\" error code: $CHECKRET"; echo; exit 3; } echo "Successfully copied e4s-info command to $PATHVAR" @@ -116,10 +118,12 @@ echo echo "Copying e4s-info manual file to $MANPATHVAR" mkdir -p "$MANPATHVAR" -[ $? -eq 0 ] || { echo "Problems making directory $MANPATHVAR. Either use \"sudo\" before command if permission was denied, check target directory for name collisions, or check the command \"mkdir\" error code: $?"; echo; exit 3; } +CHECKRET=$? +[ $CHECKRET -eq 0 ] || { echo "Problems making directory $MANPATHVAR. Either use \"sudo\" before command if permission was denied, check target directory for name collisions, or check the command \"mkdir\" error code: $CHECKRET"; echo; exit 3; } echo "Directory either already exists or was created" cp e4s-info-manual/e4s-info.1.gz "$MANPATHVAR" -[ $? -eq 0 ] || { echo "Problems copying manual file. Either use \"sudo\" before command if permission was denied, check target directory for name collisions, or check the command \"cp\" error code: $?"; echo; rm -r "${PATHVAR}e4s-info-command/"; exit 3; } +CHECKRET=$? +[ $CHECKRET -eq 0 ] || { echo "Problems copying manual file. Either use \"sudo\" before command if permission was denied, check target directory for name collisions, or check the command \"cp\" error code: $CHECKRET"; echo; rm -r "${PATHVAR}e4s-info-command/"; exit 3; } echo