Thank you, @NiLuJe! That's the fringe case example I was thinking of.
@qkqw, will adding
-limit time 60 to the variables
CONVERT &
IDENTIFY work?
Code:
#!/bin/sh
ARTICLES="/mnt/onboard/.kobo/articles"
CONVERT="/mnt/onboard/.adds/pocket/convert -limit time 60"
IDENTIFY="/mnt/onboard/.adds/pocket/identify -quiet -limit time 60"
LD_LIBRARY_PATH="/mnt/onboard/.adds/pocket/lib:${LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH
for i in $(find $ARTICLES -type f -not -iname "*.html"); do
FORMAT=$($IDENTIFY -format "%m" "$i")
if [ "$FORMAT" == "PNG" ]; then
$CONVERT "$i" "$i.jpg"
mv "$i.jpg" "${i%.jpg}"
fi
done