For an explanation on how ${f%.webp}
works, see Parameter Expansion.
${f%.webp}
does not modify the value of ${f}
, consider:
$ f=foo.webp
$ echo "${f%.webp}.png"
foo.png
$ echo "${f}"
foo.webp
Net result is that you could try something like:
for f in *.webp
do
echo "${f}"
dwebp "${f}" -o "./PNGs/${f%.webp}.png"
done
Or if you'll need to perform the same parameter expansion a few times, you can do it once and store in a new variable, eg:
for f in *.webp
do
newf="${f%.webp}.png"
echo "original file : ${f} / new file : ${newf}"
dwebp "${f}" -o "./PNGs/${newf}"
done
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…