Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dealing with Interactive Unix Scripts.

Status
Not open for further replies.

awolff01

Programmer
Jun 17, 2003
55
0
0
US
Hello,

I need to web enable some unix scripts so our users can run them via a web page.

All the scripts are written in ksh or sh and may invoke other unix scripts. (I do not want to rewrite all these scripts). What I am thinking of doing is writing a perl script (using CGI.pm) which will act as the middle man between the web and the unix scripts and allows me to display the prompts of the unix script through a web-browser..and providing a little text box for the user to enter commands.


Whats the most efficient way of calling unix script from within a perl program? Anybody know of any perl modules that might be helpful besides CGI.pm?


Thanks.

 
Given that HTTP is a stateless protocol, it would be exceedingly difficult to prompt a user via the web each time the unix script demands a further piece of information. If possible, I would suggest prompting for all the information that will be needed the first time around, for example if you were writing a web interface for passwd, you'd have 3 fields on the web page (old password, new password, retype new password), rather than trying to demand them one at a time.

FYI - to execute a command and store its output in a variable, the following two lines are equivalent:
Code:
my $output = `command`;
my $output = qx/command/;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top