How can I fix the following command, so that all files with the format specified with the rm command are deleted?
#!/bin/bash
mogrify -verbose -format webp -quality 70 *.jpg *.jpeg *.JPEG *.JPG *.png *.PNG && rm --verbose *.jpg *.jpeg *.JPEG *.JPG *.png *.PNG
$SHELL
The command successfully converts the images to webp, but rm doesn't delete any of the original files.
I get the following errors after converting to webp:
mogrify-im6.q16: unable to open image `*.jpeg': No such file or directory @ error/blob.c/OpenBlob/2874.
mogrify-im6.q16: unable to open image `*.JPG': No such file or directory @ error/blob.c/OpenBlob/2874.
mogrify-im6.q16: unable to open image `*.JPG': No such file or directory @ error/blob.c/OpenBlob/2874.
mogrify-im6.q16: unable to open image `*.png': No such file or directory @ error/blob.c/OpenBlob/2874.
mogrify-im6.q16: unable to open image `*.png': No such file or directory @ error/blob.c/OpenBlob/2874.
mogrify-im6.q16: unable to open image `*.PNG': No such file or directory @ error/blob.c/OpenBlob/2874.
mogrify-im6.q16: unable to open image `*.PNG': No such file or directory @ error/blob.c/OpenBlob/2874.
unable to open image '*.JPG': No such file or directory? If the latter, then probablymogrifyis exiting with non-zero statusmogrify ... && echo exit status $?presumably after a successful conversion the exit status is unexpectedly non-zero? Does the documentation formogrify(ieman mogrify) say anything about its exit status?rmwon't be executed