Ubuntu: How to add a launcher to a program/script inside my home dir?



Question:

I'm still using Gnome 2, and I want to add a launcher to gnome-panel that will run: ~/bin/foobar.sh.

However, when I tried that, it gives me: Failed to execute child process "~/bin/foobar.sh" (No such file or directory)

I also tried $HOME/bin/foobar.sh, same issue.

I don't want to add the absolute path to the script, I want to add a path relative to my home dir.

(also, ~/bin is added to PATH at .bashrc and .bash_profile, so it isn't added while gnome starts up)


Extra information:

$ ls -l ~/bin/foobar.sh   lrwxrwxrwx 1 username group 25 2012-01-17 18:26 /full/path/to/home/username/bin/foobar.sh -> ../other_scripts/foobar.sh*  

In other words, ~/bin/foobar.sh is a symlink to a script in another directory, and that script has the +x bit set. I can run ~/bin/foobar.sh without problems inside a terminal, so the issue is not in the script.

What I'm trying to do is to right-click on the gnome-panel and add a custom launcher. Then I write ~/bin/foobar.sh as the command, but when I try to click on the launcher, it gives me the errors I mentioned above.


Solution:1

The panel launchers don't do the same expansion of special characters as bash does, so ~ and $HOME don't do what you think...

The easiest solution is probably to use bash -c "~/bin/foobar.sh" as the command.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »