Reputation: 213
I want to resize multiple .jpg and .png images by using bash shell script.
The following script works fine, but I don't want to write same things twice.
for image in *.jpg; do
mogrify -resize x1000 "${image}"
done
for image in *.png; do
mogrify -resize x1000 "${image}"
done
How can I filter jpg and png images at once?
Upvotes: 5
Views: 3746
Reputation:
shopt -s nullglob
for image in *.jpg *.png; do
mogrify -resize x1000 "${image}"
done
Upvotes: 6