I added the following to the ~/.profile:

#Change desktop background f(x)
function changeBackground() {
    FILE="'file://$(readlink -f "$1")'"
    echo changing to "$FILE"
    gsettings set org.gnome.desktop.background picture-uri "$FILE"

Side Note: The purpose of the function is for the user to specific a path to an image file and the function takes that image file and makes it the desktop background. Example: changeBackground /backgrounds/background.png

Then I ran, export -f changeBackground and I get the following error:

./scripts/bins: line 15: export: changeBackground: not a function


  • 2
    Did you source ~/.profile before running ./script/bins so the function has actually been created? – glenn jackman Jun 6 '16 at 20:59
  • 2
    Your quoting is over-zealous. You want FILE="file://$(readlink -f "$1")" -- otherwise you're sending literal single quotes to gsettings which I don't think you want. – glenn jackman Jun 6 '16 at 21:00
  • @glennjackman No I didn't run source ~/.profile didn't realize I had too. Thanks! That fixed it. – Nicholas Adamou Jun 6 '16 at 21:01

Browse other questions tagged or ask your own question.