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'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.

share|improve this question
    
I'm not sure if this is the problem, but is the script set as executable? –  David Oneill Jan 31 '12 at 14:35
    
You have a 'bin' directory in every user's home directory? Could you provide the output of ls -l ~/bin/foobar.sh? –  jasperado Jan 31 '12 at 14:46
    
IMO, in scripts it is best to use the full path to your script. –  bodhi.zazen Jan 31 '12 at 16:19
    
Updated the question with requested information. –  Denilson Sá Jan 31 '12 at 16:30
    
Also, I don't want to use the full path because this home is shared with another computer, and in that other computer the home directory is in another path. –  Denilson Sá Jan 31 '12 at 16:50
add comment

1 Answer

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.

share|improve this answer
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.