Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.