FIx glob usage to avoid problems with directories that contain spaces

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2020-04-21 13:32:11 +02:00
parent 4651ff5a50
commit f354a4f17f
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
1 changed files with 6 additions and 4 deletions

View File

@ -8,7 +8,7 @@ function recursive_optimize_images() {
jpegoptim --strip-all *.jpg; jpegoptim --strip-all *.jpg;
# Optimize all SVGs # Optimize all SVGs
for svg in `ls *.svg`; for svg in *.svg;
do do
mv $svg $svg.opttmp; mv $svg $svg.opttmp;
scour --create-groups \ scour --create-groups \
@ -26,10 +26,12 @@ function recursive_optimize_images() {
rm *.opttmp rm *.opttmp
# Check all subfolders # Check all subfolders
for dir in `ls -d */`; for dir in */
do do
recursive_optimize_images $dir; if [[ -d "$DIR" ]]; then
cd ..; recursive_optimize_images "$dir"
cd ..
fi
done; done;
} }