1

I have some problem here when I'm trying to make a keyboard shortcut for my ruby script. So the first step I've do for it was to make a alias and add that command for alias on file .bashrc

alias note="~/ums.rb > note.txt && gedit note.txt && rm note.txt"

Now I can access my command using just the alias. After that I've try to make a new keyboard shortcut, so I've enter on Settings -> Keyboard -> Shortcuts and add that command as shortcut

gnome-terminal -e "note"

But I don't know why... nothing happened when I use the shorcut.

Can anyone help me please? :D

  • Try source ~/.bashrc this should reload the .bashrc file so that you alias work. – Alex Lowe Jan 29 '16 at 23:14
2

Aliases are not available to the GUI shortcut tools. They don't read .bashrc, for one thing and the don't run the normal bash shell anyway. Aliases only work on the command line.

So, instead of using the alias, just make a shortcut that launches a shell and runs the command itself:

bash -c "~/ums.rb > note.txt && gedit note.txt && rm note.txt"

If your ruby script relies on variables set in your ~/.bashrc, source it:

bash -c ". ~/.bashrc && ~/ums.rb > note.txt && gedit note.txt && rm note.txt"
  • Thx man, but that works just partial. Because if I will put that as shortcut... I will obtain that result nokogiri gem not installed gem install nokogiri but in command line works fine – Vildnex Jan 29 '16 at 23:38
  • @Vildnex well yes, that's because you need things that you are setting in your shell's configuration files. Please edit your question and explain that/. We need to know all relevant details. In the meantime, try changing the command to bash -c ". ~/.bashrc && ~/ums.rb > note.txt && gedit note.txt && rm note.txt" – terdon Jan 29 '16 at 23:40
  • Thx man, rly thx, that second command works fine :D – Vildnex Jan 29 '16 at 23:42

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.