Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

What I'd like to do is be able to start external programs from links in a local website.

I've defined a custom protocol handler in firefox by setting the following variables in about:config


This successfully causes firefox to open a 'launch application' dialog box when I click on a link in the form myprotocol:///path_to_program_I_want_to_run, and then I browse to the shell script I want to use and tell firefox to run it. Unfortunately the script doesn't seem to be run at all.

I've set the file permissions to 777 so firefox shouldn't have any trouble running it

The shell script originally only contained the line


The idea being that the path of the link would be passed in as the first argument and would immediately be run as a program. This worked fine when I ran the script myself using commands like

#./ gedit 


#./ /home/ciaran/test_program

The script now for testing purposes contains only the line

echo "testing" > /testing/file.txt

where 'testing' is a directory with 777 permissions. Also note that /testing/ actually is located at the root of my filesystem (though i can't remember why i put it there!), so I haven't just gotten mixed up between relative and absolute paths

Again, this runs perfectly fine when I run it from the terminal, and file.txt is created in the right location. With firefox though, I am given the option to choose an application to run, I choose that shell script, and it doesn't seem to do anything. file.txt is not created at all, though there are no permission issues that I can see. So firefox just doesn't seem to be running the script.

I have also tried changing my about:config to contain



with no success

share|improve this question
up vote 1 down vote accepted

Found the problem

I didn't put #!/bin/bash at the top of the file. I was basically thinking of the shell script in the same way as a binary executable or something, rather than as an interpreted script, because I didn't need that line to run it directly in the terminal. I forgot that to run it from another program it has to be run through bash

So once that line is at the top of the script you can choose the shell script from firefox as the program to run your custom links with, and the link will successfully be passed into the script as the first argument.

share|improve this answer

Your Answer


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.