You can use syntax like the following:
for f in /tmp/*.{jpg,png}; do
echo "filename: $f"
done
Update:
For better handling of the case when there is no file matching the pattern, you might try Pathname Expansion instead of Brace Expansion:
for f in *[email protected](jpg|png); do
echo "filename: $f"
done
From what I understand, Brace Expansions can expand to file names that don’t exist, while Pathname Expansions…can…not…?
CLICK HERE to find out more related problems solutions.