Calling bash script from firefox.

Talk about add-ons and extension development.
Posts: 1
Joined: June 6th, 2008, 3:27 pm

Post Posted June 6th, 2008, 3:38 pm

Hi guys,

I know little about firefox and am looking for a pointer in the right direction.

The short version is, I want to call a bash script from firefox somehow and am wondering what the best way to proceed is. Is there a quick and easy way to do this? Javascript does not seem to be able to for security reasons (or maybe I am wrong?).

The long version:

There's a nice web interface for finding geocaches integrated with google maps here ... zm=15&mt=m

On the cache pages (for example, here ... 61dc148dcf) there is a .loc file that can be downloaded to a GPS rather than typing it in by hand. But what I really want is to be able to go straight from the web interface to downloading the file on the GPS, in one click (or one command). I'm fairly sure it would be easy to pass a URL to a script and use wget to get the .loc, then call a command line program to send the .loc to the GPS.

The question is: how to pass the URL from firefox to a bash script? I don't want to copy them by hand every time. There should be a way to press a button and have firefox call the bash script on that URL. Any ideas?

Thanks in advance.

Posts: 9
Joined: January 9th, 2008, 9:41 pm

Post Posted June 10th, 2008, 8:51 pm

Javascript executed by http:// urls is run in a sandbox to keep untrusted web sites from accessing your system. However, Javascript that is executed by chrome:// urls (Fx extensions) is privileged and therefore can execute your bash script.

Here is the basic example of how to execute a file on the system using XPCOM.

Code: Select all
var shell = "/bin/sh";

var file = Components.classes[";1"]

var process = Components.classes[";1"]


var args = ["path/to/script","arg1","arg2","etc"];, args, args.length);

Hope that points you in the right direction. You can create an extension/greasemonkey script to gather your url and use this technique to automate your process.

Posts: 1
Joined: November 12th, 2009, 10:40 am

Post Posted November 12th, 2009, 10:51 am

I'm trying to add some simple bash scripts to my context menu. (Gathering URL as bash variable and executing a bash script with it)

I have a basic knowledge of bash but unfortunately not javascript.

Is it as easy as just creating a greasemonkey script with muiredised code?

Any help, or comments, would be really appreciated!


Posts: 1
Joined: November 23rd, 2009, 3:21 pm

Post Posted November 23rd, 2009, 3:25 pm

I want to be able to call an exe file from my extension. How can this be done?

New Member

User avatar
Posts: 40048
Joined: October 18th, 2007, 1:45 pm
Location: Next door to the west

Post Posted November 23rd, 2009, 3:26 pm

You both are replying to an elderly thread. Locking. Please start a new thread fully describing the problem.
Post wrangler
"Choose between the Food Select Feature or other Functions. If no food or function is chosen, Toast is the default."

Return to Extension Development

Who is online

Users browsing this forum: Google [Bot] and 3 guests