Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
02-14-2013, 08:38 AM
|
#1
|
|
LQ Newbie
Registered: Dec 2011
Distribution: Slackware 14.0
Posts: 14
Rep: 
|
How to run bash script from link on webpage?
Hello
I'd like run bash srcript (click on webpage link).
So I create new network.protocol-handler.app.bash (value /usr/bin/terminal) in firefox (about :config).
Click on link to script (bash:///home/user/moj/echo.bash)
And I have firefox error
Code:
Firefox doesn't know how to open this address, because the protocol (bash) isn't associated with any program
Maybe I need register new url scheme in my xfce?
|
|
|
|
02-14-2013, 09:16 AM
|
#2
|
|
Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 12,008
|
Quote:
Originally Posted by inkscape
Hello
I'd like run bash srcript (click on webpage link).
So I create new network.protocol-handler.app.bash (value /usr/bin/terminal) in firefox (about :config).
Click on link to script (bash:///home/user/moj/echo.bash)
And I have firefox error
Code:
Firefox doesn't know how to open this address, because the protocol (bash) isn't associated with any program
Maybe I need register new url scheme in my xfce?
|
No, you need to read up on how to write web pages to execute code. Scripts/programs are typically in the cgi-bin directory, or can be called through PHP or javascript functions. Your window manager has nothing to do with it.
Just from putting "how to run a script from a webpage" into Google, it pulls up this as the very first hit:
http://www.cyberciti.biz/faq/run-she...from-web-page/
|
|
|
|
02-14-2013, 10:25 AM
|
#4
|
|
Moderator
Registered: May 2001
Posts: 24,970
|
Web browsers recognize and handle certain MIME types themselves (text/html, image/png, etc, etc.). Those that aren't recognized internally are often handled by plugins (application/pdf, video/mp4, etc, etc.). If no "helper" applications are found you'll be asked to point to one. So, if you mean you want to execute an application based on a protocol (say "magnet://") or a MIME type (application/x-shellscript, text/x-java), then that will work. Maybe you should be specific about what you want to achieve and give an example.
|
|
|
|
02-14-2013, 10:49 AM
|
#5
|
|
Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 12,008
|
Quote:
Originally Posted by inkscape
|
Ok...did you read the link I posted in my first reply?? It has an example of how to do it, along with a bash script.
|
|
|
|
02-14-2013, 12:53 PM
|
#6
|
|
LQ Newbie
Registered: Dec 2011
Distribution: Slackware 14.0
Posts: 14
Original Poster
Rep: 
|
@TB0ne I read. I want start bash script by click link on local web page.
I haven't running web server
Code:
ls -la /etc/rc.d/rc.httpd
-rw-r--r-- 1 root root 1061 sie 23 18:07 /etc/rc.d/rc.httpd
@unSpawn I have some html pages created with asciidoc, and I want edit it with text editor.
On each of them will put a link that will open an external editor and I can easily edit sources files (.txt).
|
|
|
|
02-14-2013, 02:01 PM
|
#7
|
|
Moderator
Registered: May 2001
Posts: 24,970
|
Then why not just use a File manager if the files are local, or a Graphical SFTP or FTPS client if they are remote, browse, double click item to open with the editor and be done with it?
|
|
|
|
02-14-2013, 02:08 PM
|
#8
|
|
LQ Newbie
Registered: Dec 2011
Distribution: Slackware 14.0
Posts: 14
Original Poster
Rep: 
|
because I want use firefox and I do not want to get around the problem
|
|
|
|
02-14-2013, 02:33 PM
|
#9
|
|
Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 12,008
|
Quote:
Originally Posted by inkscape
@TB0ne I read. I want start bash script by click link on local web page.
I haven't running web server
Code:
ls -la /etc/rc.d/rc.httpd
-rw-r--r-- 1 root root 1061 sie 23 18:07 /etc/rc.d/rc.httpd
|
Then your question makes no sense at all. If you don't have a web server, how do you think you're going to serve up web pages???. If you're just clicking File->Open on a local file, open it with a text-editor, which is what it was DESIGNED TO DO.
Otherwise, the link I gave you explicitly tells you how to make a bash script work through a web page, and has an example of how to do it. Doesn't get much simpler than that. So, if you did read/understand it, you have an answer.
Quote:
|
Originally Posted by inkscape
because I want use firefox and I do not want to get around the problem
|
No, you're not 'getting around' a problem by using the right program for the right job...you're doing what makes the most sense, and using the correct tool for the job. Using a web browser to open a shell script to open a file is creating a LOT more work for yourself, and is going to CREATE problems, and make things harder to use.
Last edited by TB0ne; 02-15-2013 at 09:05 AM.
|
|
|
|
02-15-2013, 12:43 AM
|
#10
|
|
Guru
Registered: Aug 2004
Location: Brisbane
Distribution: Centos 6.4, Centos 5.9
Posts: 15,261
|
This
Quote:
|
Then your question makes no sense at all. If you don't have a web server, how do you think you're going to server up web pages???.
|
I'm so glad you said that; I thought for a minute it was just me 
|
|
|
|
02-15-2013, 09:43 AM
|
#11
|
|
LQ Newbie
Registered: Dec 2011
Distribution: Slackware 14.0
Posts: 14
Original Poster
Rep: 
|
I edit firefox mimeTypes.rdf (new Type File zz, action sublime-text)
I change extension .txt files on .zz
Put in end line:
file:///path/file.zz
Use asciidoc to create html files.
So, then I click on link, text editor open with file.zz
Now I can quickly and just as I edit the files.
Achieved his goal.
But I'm wonder how to execute local bash script in firefox something like:
bash://path-to-script.bash in url bar.
|
|
|
|
02-15-2013, 09:59 AM
|
#12
|
|
Moderator
Registered: May 2001
Posts: 24,970
|
See the link TB0ne posted in post #2.
|
|
|
|
02-15-2013, 10:20 AM
|
#13
|
|
Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 12,008
|
Quote:
Originally Posted by inkscape
I edit firefox mimeTypes.rdf (new Type File zz, action sublime-text)
I change extension .txt files on .zz
Put in end line:
file:///path/file.zz
Use asciidoc to create html files.
So, then I click on link, text editor open with file.zz
Now I can quickly and just as I edit the files.
Achieved his goal.
But I'm wonder how to execute local bash script in firefox something like:
bash://path-to-script.bash in url bar.
|
Don't know why you're wondering...you've been pointed to how to do it a few times now. That page is very, VERY clear, and has examples.
|
|
|
|
03-03-2013, 11:24 AM
|
#14
|
|
Guru
Registered: Apr 2005
Location: /dev/null
Distribution: technixOS
Posts: 5,723
|
This is off topic, but I vote this thread for the "Best of 2013" award.
|
|
|
|
05-28-2013, 12:39 AM
|
#15
|
|
LQ Newbie
Registered: Mar 2013
Posts: 10
Rep: 
|
how to execute/ run a linux commond from HTML page..?
In my project I have to run a unix commond from html page to change my IP address of my target board.
can some one suggest me how to achieve this.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 11:34 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|