I try to execute a bash script from a shortcut set from the settings (system settings > keyboard > shortcuts or analogous), but it doesn't execute, although it works just fine from the terminal...

The script is as following :

#"$1" should be a number from 0 to 5
if [ "$#" == 0 ]; then
   echo "Ce programme nécessite en argument le nombre d'étoiles (de 0 à 5) à attribuer à la chanson qui est en train de tourner dans Rhythmbox."

rhythmbox-client --set-rating $1
notify-send "$1 étoiles" "$(rhythmbox-client --print-playing)" --expire-time=1000 --icon=starred

Then I set the shortcut, but it doesn't work (Noting happens). As said before, the same code executed from the terminal works great...


Thanks for helping me !!

  • Have you tried the same command but included the program/interpreter? I.e. bash. For example: bash ~/Scripts/rhythmbox-set-stars.sh 5 – The Pizza Overlord Jul 12 '17 at 14:07
  • No, it still doesn't... Neither with bash -c '~/Scripts/rhythmbox-set-stars.sh 5' Is there a way of debugging that ? Or do you have other ideas ? – Johannes Lemonde Jul 12 '17 at 14:13
  • You may laugh, but I restarted my session and it finally worked with the "bash" interpreter as you advised me :) As if the changes on an existing shortcut weren't taken into account :/ Thanks to you !! Note that I also used the real path with /home/username/Scripts/rhythmbox...... – Johannes Lemonde Jul 12 '17 at 14:21

The command defined in the pertinent field was missing the file interpreter (in this case: bash), and should have been using the files' absolute path.

Ergo: bash /home/username/Scripts/rhythmbox-set-stars.sh 5

A restart of the utility/session was required to apply the new values, presumably because values for the session were updated from the modified .gconf file.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.