Skip to content

Commit fa9f11d

Browse files
committed
Handle invalid user input
1 parent 7c01c8b commit fa9f11d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

fetchurls.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
VERSION="v3.3.1"
3+
VERSION="v3.4.0"
44

55
# Set Defaults
66
WGET_INSTALLED=0
@@ -494,6 +494,13 @@ elif [ -z "$USER_SAVE_LOCATION" ] && [ "$RUN_NONINTERACTIVE" -eq 1 ]; then
494494
# Running non-interactive, so set to default
495495
USER_SAVE_LOCATION="$DEFAULT_SAVE_LOCATION"
496496
fi
497+
498+
# If user cleared out the default save location and continued, revert to back to default
499+
if [ -z "$USER_SAVE_LOCATION" ]; then
500+
USER_SAVE_LOCATION="$DEFAULT_SAVE_LOCATION"
501+
echo "${COLOR_YELLOW}NOTE: Saving to default location '$USER_SAVE_LOCATION'${COLOR_RESET}"
502+
fi
503+
497504
# Create directory if it does not exist
498505
mkdir -p $USER_SAVE_LOCATION
499506

@@ -510,6 +517,12 @@ elif [ -z "$USER_FILENAME" ] && [ "$RUN_NONINTERACTIVE" -eq 1 ]; then
510517
USER_FILENAME="$GENERATED_FILENAME"
511518
fi
512519

520+
# If user cleared out the default filename and continued, revert to back to default
521+
if [ -z "$USER_FILENAME" ]; then
522+
USER_FILENAME="$GENERATED_FILENAME"
523+
echo "${COLOR_YELLOW}NOTE: Saving as '$USER_FILENAME'${COLOR_RESET}"
524+
fi
525+
513526
# USER_EXCLUDED_EXTENTIONS
514527
if [ -z "$USER_EXCLUDED_EXTENTIONS" ] && [ "$RUN_NONINTERACTIVE" -eq 0 ]; then
515528
# Prompt user for excluded file extensions

0 commit comments

Comments
 (0)