I have a script and when I run it, it returns
Directory not found: ~/Pictures/Wallpaper
The script is as follows:
#!/bin/bash
# Check if the wallpaper directory exists
if [ ! -d "$WALLPAPER_DIR" ]; then
echo "Directory not found: $WALLPAPER_DIR"
exit 1
fi
# Get currently loaded wallpaper
CURRENT_WALL=$(hyprctl hyprpaper listloaded)
# Get a random wallpaper that is not the current one
IMAGE=$(find "$WALLPAPER_DIR" -type f ! -name "$(basename "$CURRENT_WALL")" | -iname "*.jpg" -o -iname "*.png" -o -iname "*.jpeg" | shuf -n 1)
# Verify that an image was found
if [ -z "$IMAGE" ]; then
echo "No images found in $WALLPAPER_DIR"
exit 1
fi
The $WALLPAPER_DIR environment variable is configured in my hyprland.conf file and it has a value of ~/Pictures/Wallpaper that I have verified. I have run the echo $WALLPAPER_DIR command it returns with
~/Pictures/Wallpaper
I'm rather perplexed as to why it is returning with the negative of the if statement when the variable and folder do in fact exist.