0

I'm trying to write a simple shell script that I can use in my file manager Dolphin to merge selected images to GIF. The following don't work, and I can't figure out the reason:

OUTPUT="$(kdialog --title "Merge to GIF" --inputbox "Please enter new file name:").gif"
INPUT="$(echo ${@} | sed -e 's/^/"/' -e 's/$/"/' -e 's/ /" "/g')"
convert -delay 60 "$INPUT" "$OUTPUT"
1
  • one issue is that "$INPUT" is going to be provided as one single argument, unlike $INPUT which would be split according to IFS – Fox Oct 3 '20 at 20:33
0

I don't know why that one doesn't work, but this works:

OUTPUT="$(kdialog --title "Merge to GIF" --inputbox "Please enter new file name:").gif"
convert $(for i in "${@}"; do printf -- "-delay 60 %s " "$i"; done;) "$OUTPUT"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.