@@ -64,15 +64,17 @@ while (( "$#" )); do
6464 # FILENAME
6565 -f|--filename)
6666 if [ " $2 " ]; then
67- USER_FILENAME=" $2 "
67+ # Remove non-alpha-numeric characters (other than dash)
68+ USER_FILENAME=" $( echo " $2 " | sed ' s/[^[:alnum:]-]//g' ) "
6869 shift # Remove argument name from processing
6970 else
7071 echo " ${COLOR_RED} ERROR: Value for $1 is required. Remove $1 flag to use the default value." ${COLOR_RESET} >&2
7172 exit 1
7273 fi
7374 ;;
7475 -f=* |--filename=* )
75- USER_FILENAME=" ${1#* =} "
76+ # Remove non-alpha-numeric characters (other than dash)
77+ USER_FILENAME=" $( echo " ${1#* =} " | sed ' s/[^[:alnum:]-]//g' ) "
7678 shift # Remove filename from processing
7779 ;;
7880 # LOCATION
@@ -101,7 +103,8 @@ while (( "$#" )); do
101103 fi
102104 ;;
103105 -e=* |--exclude=* )
104- USER_EXCLUDED_EXTENTIONS=" ${1#* =} "
106+ # Remove first and last character, if either is a pipe
107+ USER_EXCLUDED_EXTENTIONS=" $( echo " ${1#* =} " | sed ' s/^|//' | sed ' s/|$//' ) "
105108 shift # Remove location from processing
106109 ;;
107110 # End of all options
@@ -320,6 +323,12 @@ elif [ "$SHOW_VERSION" -eq 1 ]; then
320323 showVersion
321324 exit
322325elif [ " $SHOW_WGET_INSTALL_INFO " -eq 1 ] || [ " $WGET_INSTALLED " -eq 0 ]; then
326+
327+ # If user passed troubleshoot flag, output variables
328+ if [ " $SHOW_TROUBLESHOOTING " -eq 1 ]; then
329+ showTroubleshooting
330+ fi
331+
323332 showWgetInstallInfo
324333 exit
325334fi
@@ -380,7 +389,8 @@ if [ -z "$USER_FILENAME" ] && [ "$RUN_NONINTERACTIVE" -eq 0 ]; then
380389 echo " ${COLOR_RESET} "
381390 echo " Save file as"
382391 read -e -p " Filename (no file extension, and no spaces): ${COLOR_CYAN} " -i " ${GENERATED_FILENAME} " USER_FILENAME
383- USER_FILENAME=" $USER_FILENAME "
392+ # Remove non-alpha-numeric characters (other than dash)
393+ USER_FILENAME=" $( echo " $USER_FILENAME " | sed ' s/[^[:alnum:]-]//g' ) "
384394else
385395 # Running non-interactive, so set to default
386396 USER_FILENAME=" $GENERATED_FILENAME "
0 commit comments