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.
Asked
Active
Viewed 6,972 times
4

Jorge Castro
- 71,754
-
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 01:32
1 Answers
5
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
?

AgentK
- 1,080
-
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 01: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 -