I want to build a script to convert any *.png files to *.jpg files using convert.

Doing manually works fine.

Building a script has presented problem. I am well versed in programming but a novice with bash.

My loop through the files works fine.

#!/bin/bash
cd /big1/memes/;

shopt -s nullglob
for f in "*.png"
do
    echo $f
done

I get a list of filenames with an extension of .png

But when I try to get the basename with:

#!/bin/bash
cd /big1/memes/;

shopt -s nullglob
for f in "*.png"
do
    echo $f
    b=${f%.png}
    echo $b
done

I first get a list of the .png files, then a list of all files, both the existing .jog and the .png. This gets a WTF reaction from me.

Can someone explain and help me get closer to getting this to work?

Thanks

--
Stephen
---
Talk Mailing List
[email protected]
https://gtalug.org/mailman/listinfo/talk

Reply via email to