Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just made a custom keyboard shortcut, which is to execute the following command :

if [[ `banshee --query-current-state | grep playing` ]]; then banshee --pause; else banshee --play; fi

While this works flawlessly in a terminal, when I try to run it via the shortcut I just made I get this error :

Error while trying to run (if [[ `banshee --query-current-state | grep playing` ]]; then banshee --pause; else banshee --play; fi) which is linked to the key (XF86AudioPlay)

What am I doing wrong ?

share|improve this question
Yes, it does. Why doesn't it look alright ? – leaf Nov 4 '12 at 14:06
up vote 2 down vote accepted

Make sure that your script is being run by Bash, since you're using Bash builtins. Try this:

bash -c 'if [[ `banshee --query-current-state | grep playing` ]]; then banshee --pause; else banshee --play; fi'
share|improve this answer
This works, thank you ! – leaf Nov 4 '12 at 14:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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