Fixed missing double quotes using ShellCheck

This commit is contained in:
Louis Lacoste 2022-10-26 14:46:14 +02:00
parent eac1527d49
commit af79f3ae21

View file

@ -31,7 +31,7 @@ usage () {
dir_list () { dir_list () {
echo "-Folder $1-" 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 do
echo "Scanning: $FILE" echo "Scanning: $FILE"
@ -39,11 +39,11 @@ dir_list () {
if [[ -d "$FILE" ]]; then if [[ -d "$FILE" ]]; then
# If it is we loop over its content # If it is we loop over its content
echo "$FILE is actually a directory !" echo "$FILE is actually a directory !"
dir_list $FILE $2 dir_list "$FILE" "$2"
else else
echo "$FILE is not a directory ! Adding it to the list" echo "$FILE is not a directory ! Adding it to the list"
# Writing the file in the output list # Writing the file in the output list
echo $FILE >> $2 echo "$FILE" >> "$2"
fi fi
done done
echo "-----------------------------------------------" echo "-----------------------------------------------"
@ -62,10 +62,10 @@ else
echo "$2 exists, backing it up to $2.old" echo "$2 exists, backing it up to $2.old"
if [ -f "$2.old" ]; then if [ -f "$2.old" ]; then
echo "$2.old exists already ! Deleting it" echo "$2.old exists already ! Deleting it"
rm $2.old rm "$2".old
fi fi
mv $2 $2.old mv "$2" "$2".old
fi fi
touch $2 touch "$2"
dir_list $1 $2 dir_list "$1" "$2"
fi fi