I\'m trying to write script that\'ll crop and resize large photos into HD Wallpapers.
#! /bin/bash
for i in `ls *.jpg`
do
width=`identify -format \'%w
Use read to circumvent the problem with spaces. It looks a bit unnatural to write the loop like this but it works better:
find . -type f -iname "*.jpg" | while read i
do
# your original code inside the loop using "$i" instead of $i
done
with -iname you also get the jpg files that might have an extension with different casing like .JPG. "i" in "iname" means ignore casing.