D
D
Dima2019-10-28 14:40:19
bash
Dima, 2019-10-28 14:40:19

How to set file extension in bash variable?

There is such a script that changes the scale of the picture and replaces the original with it.
convert -resize 49.6% "$file" "$file"
I want every file modified by this script to have a .jpg file extension (not jpeg, jpg, jpeg like the originals have). How to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Shitskov, 2019-10-28
@qpz

Maybe,
convert -resize 49.6% "$file" "${file/%\.*/.jpg}"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question