diff --git a/dot_config/profile/profile.d/functions.sh.tmpl b/dot_config/profile/profile.d/functions.sh.tmpl index 50e44bb..5af8c9e 100644 --- a/dot_config/profile/profile.d/functions.sh.tmpl +++ b/dot_config/profile/profile.d/functions.sh.tmpl @@ -95,19 +95,25 @@ command_installed() ( min_jpg() ( set -ue command_installed jpegtran - file=$1 - out_file=$(mktemp) - jpegtran -optimize -perfect -outfile "$out_file" "$file" - mv "$out_file" "$file" + for FILE in "$@" ; do + PERMISSIONS=$(stat --format '%a' "${FILE}") + OUT_FILE=$(mktemp) + jpegtran -optimize -perfect -outfile "${OUT_FILE}" "${FILE}" + mv "${OUT_FILE}" "${FILE}" + chmod "${PERMISSIONS}" "${FILE}" + done ) min_png() ( set -ue command_installed pngcrush - out_file=$(mktemp) - file=$1 - pngcrush -rem alla -reduce -brute "$file" "$out_file" - mv "$out_file" "$file" + for FILE in "$@" ; do + PERMISSIONS=$(stat --format '%a' "${FILE}") + OUT_FILE=$(mktemp) + pngcrush -rem alla -reduce -brute "${FILE}" "${OUT_FILE}" + mv "${OUT_FILE}" "${FILE}" + chmod "${PERMISSIONS}" "${FILE}" + done ) get_create_date() (