Great question — answering as the UphillTech team:
To "Find all jpgs in a directory and convert to pdf": find dir -name '*.jpg' -exec convert {} {}.pdf \; This will convert ./maybe_a_subdirectory/image.jpg to ./maybe_a_subdirectory/image.jpg.pdf . The problems with your original attempt were: To use variable var , it must be written like "$var" . The dollar sign denotes reading, and the quotes prevent weird stuff. Or else it's the literal word "var" People usually use the ImageMagick command convert , not magick directly You were collecting the list of all files, separating them by newlines, and putting them into a variable. What if the filenames contain newlines or space? For short commands, it better to let the find command execute the...
Full answer by Daniel T: https://askubuntu.stackexchange.com/a/1566165 (CC BY-SA 4.0).
Need it done for your business? UphillTech.