I am trying to create a script, which will change the wallpaper automatically when run.
#!/bin/bash
cd ~/
rm -r ~/.wallpaper
mkdir .wallpaper
cd ~/.wallpaper
wget https://source.unsplash.com/random/1920x1080
USER=$(whoami)
PATH="file:///home/$USER/.wallpaper/1920x1080"
echo $PATH
gsettings set org.gnome.desktop.background picture-uri "$PATH"
But when i do ./change_wallpaper.sh
I get the echo correctly, but then
./change_wallpaper.sh: line 12: gsettings: command not found
However, when I run the same command from terminal, it executes fine and wallpaper is getting changed.
When I run whereis gsettings
it tells
gsettings: /usr/bin/gsettings /usr/share/man/man1/gsettings.1.gz
Why is it showing gsettings: command not found
when I execute from script?