Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm looking to add a menu item to the applications menu in Ubuntu which will run a shell script. In order for the shell script to work I need to cd into the directory which contains the shell script. For example this works:

cd /etc/foo/launch.sh ./launch.sh

But this does not, assuming you're not already in the directory foo:

/etc/foo/launch.sh

How can I add a new menu item to the applications menu such that it changes to the directory /etc/foo before running launch.sh? I don't have permission to modify launch.sh. And I already tried this, and it doesn't work: Command: cd /etc/foo/launch.sh; ./launch.sh.

Thanks!

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

A bit dirty, but try this:

bash -c "cd /etc/foo; ./launch.sh"
share|improve this answer
add comment

One possibility would be to create a script that does the cd and runs the script, then add that wrapper script to the menu.

share|improve this answer
    
This solution would also work. Thank you! –  Corey T Foote Nov 6 '10 at 3:29
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.