Skip to content

Commit

Permalink
Possible Error Code Bug Fix
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
CarterGrove24 committed Jun 14, 2022
1 parent ea7f43a commit 998ce0f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions e4s-info-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,25 @@ 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"

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

Expand Down

0 comments on commit 998ce0f

Please sign in to comment.