Last active
July 9, 2023 09:36
-
-
Save tenox7/04361c115c723e9b3a0dba44215f0613 to your computer and use it in GitHub Desktop.
universal convert shell script, name it as a destination extension, eg. 'jpg'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
src="${1?:No filename specified}" | |
dst="${src%.*}.$(basename ${0})" | |
echo "Converting '${src}' to '${dst}'" | |
[ -f "${src}" ] || { echo "Source file '${src}' not found"; exit 1; } | |
some_command "${src}" "${dst}" | |
[ -f "${dst}" ] || { echo "Destination file '${dst}' not found"; exit 1; } | |
rm -f "${src}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment