Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How do I get input from a form to run a linux shell script?

Posted on 2007-11-21
2
Medium Priority
?
235 Views
Last Modified: 2013-12-25
I have a script on a linux box that runs as this "script.sh argument1 argument2" How would I be able to define the arguments by a simple HTML form so that someone could run the report that this generates?
0
Comment
Question by:guitchicken
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 48

Accepted Solution

by:
Tintin earned 2000 total points
ID: 20331067
Create a form, eg:

<form action="/cgi-bin/script.pl" method="POST">
<i<input type="text" name="arg1" size="20">
<input type="text" name="arg2" size="20">
</form>

Then script.pl looks like:

#!/usr/bin/perl
use CGI;
my $q = new CGI;
my $arg1 = $q->param('arg1');
my $arg2 = $q->param('arg2');
print $q->header('text/plain');
system "/path/to/script.sh", $arg1, $arg2;

Note that you should make sure you sanitise any data from the form before calling the script.
0
 
LVL 3

Author Comment

by:guitchicken
ID: 20333125
Thanks, that worked great! I had the script already made but was asked for a web form to run it last minute and this definately saved me time trying to find out what needed to be done.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question