For a tiny task, I wish to execute a .sh script from within browser.
I have kept the .sh script in "/usr/lib/cgi-bin" directory.
The .sh file contains following code.

echo "Content-type: text/html"
python ohlc.py

html code (minimal) is as follows.

     <a href="file:///usr/lib/cgi-bin/ohlc_bat.sh">Run</a>

After clicking the link, it opens a download dialog-box.
How do I make the .sh script run?

p.s. I have tried renaming the .sh file as .cgi , no luck.

  • This problem was already answered on SuperUser. – Donarsson Apr 27 '13 at 11:40
  • I had checked that link. But it requires php. In fact, for more complex apps, I am using web2py. But here, I am trying to avoid using a cannon for shooting a rat. – Vineet Apr 27 '13 at 11:47

I assume, you want the script to run on client side. (For server side, you would have to use php, as mentioned in one of the comments).
If you are using Firefox, you have to write this as an add-on. Note that simple javascript functions are executed under a sand box, so making an add-on becomes essential for you.
There used to be add-ons which could execute any bash script for you. Source
You can find this link relevant, to start writing such an add-on.

  • Thanks for the reply. However, it looks like that running my task from "web2py" would be simpler compared to the processes mentioned in the links. – Vineet Apr 27 '13 at 12:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.