Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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


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


share|improve this question
up vote 1 down vote accepted

A bit dirty, but try this:

bash -c "cd /etc/foo; ./"
share|improve this answer

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .