I have bash script below to AI upscale a bunch of images and then re encode them to reduce file size, it works fine if I call the script from the terminal but not when I select it in nautilus as a nautilus script.
I have put the script in the nautilus scripts folder and it appears in the menu, the script runs but the part that re encodes the images does not work and I don't know why because there is no debugging output for scripts called from nautilus.
Maybe there are some environment variables that do not work if launched from nautilus, thats all I can think of.
#!/bin/sh
PS4='$LINENO: '
OIFS="$IFS"
IFS=$'\n'
set -x
for arg
do
mkdir "${arg}US"
/Programs/realesrgan-ncnn-vulkan -i "$arg" -o "${arg}US" -n realesrgan-x4plus -s 4 -f jpg
rm -rf "$arg"
cd "${arg}US"
DIR="${arg}US/*"
for picture in $DIR
do
nice -19 /usr/bin/cjpeg -quality 85 "$picture" > "${picture%.*}RC.jpg"
rm "$picture"
done
done
IFS="$OIFS"
exec > ~/debuglog 2>&1at the top and you'll get your logs