From af79f3ae216bdfa93a8dd58ae1466259a1c7ea4d Mon Sep 17 00:00:00 2001 From: Polarolouis Date: Wed, 26 Oct 2022 14:46:14 +0200 Subject: [PATCH] Fixed missing double quotes using ShellCheck --- recursive-dir-content.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/recursive-dir-content.sh b/recursive-dir-content.sh index 3e34f2b..ebd3039 100755 --- a/recursive-dir-content.sh +++ b/recursive-dir-content.sh @@ -31,7 +31,7 @@ usage () { dir_list () { echo "-Folder $1-" - for FILE in $1/* # Loop over the files in the folder given as first arg + for FILE in "$1"/* # Loop over the files in the folder given as first arg do echo "Scanning: $FILE" @@ -39,11 +39,11 @@ dir_list () { if [[ -d "$FILE" ]]; then # If it is we loop over its content echo "$FILE is actually a directory !" - dir_list $FILE $2 + dir_list "$FILE" "$2" else echo "$FILE is not a directory ! Adding it to the list" # Writing the file in the output list - echo $FILE >> $2 + echo "$FILE" >> "$2" fi done echo "-----------------------------------------------" @@ -62,10 +62,10 @@ else echo "$2 exists, backing it up to $2.old" if [ -f "$2.old" ]; then echo "$2.old exists already ! Deleting it" - rm $2.old + rm "$2".old fi - mv $2 $2.old + mv "$2" "$2".old fi - touch $2 - dir_list $1 $2 + touch "$2" + dir_list "$1" "$2" fi \ No newline at end of file