Just like the title says, how do I launch a bash script in my ~/Downloads folder using a keyboard shortcut? I've tried binding cd ~/Downloads && ./bash-script.sh to different accelerators (ex. the "Tools" button or music player button on my keyboard, and F4) but no luck, yes the script is marked executable, I am trying to do this under "Custom Shortcuts" in System Settings -> Keyboard, and the command works in Terminal.

  • have you tried binding '/home/Downloads/bash-script.sh' ? I'm assuming you have your #!/bin/bash as the first line? – Matt Barnes May 15 '12 at 1:32

I have a keyboard shortcut to launch a script to start conky for me.

Now it sounds like you have tried to 'all the right things'. In the command section of keyboard shortcuts I have: /home/karl/bin/start-conky.sh

If you have cd ~/Downloads && ./bash-script.sh in that field have you tried changing it to: /home/username/Downloads/bash-script.sh?

  • Thanks, that did it. I'm a little new to making my own scripts. @Matt No, my script starts with "cd ~/Downloads". Should it start with #!/bin/bash? It works regardless. – Alucai Vivorvel May 15 '12 at 1:40
  • @AgentK, your absolute path tip was the key. ~/Downloads/file.sh did not work while /home/usrname/Downloads/file.sh did. Looks like Ubuntu doesn't like ~ for keyboard shortcuts – Manuel J. Diaz Aug 26 '16 at 19:15
  • Wow. It's good to know this is still an issue. – AgentK Aug 26 '16 at 22:48

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.