| | |
Passing parameters to a system call
Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2005
Posts: 3
Reputation:
Solved Threads: 0
Ok. I am trying to write a perl program to automate installation of certain softwares (as root) on a linux machine. I want my perl program to call an installation script and provide parameters to that script such that I do not have to enter 'yes', 'no', 'continue', create directory?', etc, from the command line. I want to fully automate the installation process without much user interaction via keyboard. I need help. Thanks
•
•
•
•
Originally Posted by eachowcc
Ok. I am trying to write a perl program to automate installation of certain softwares (as root) on a linux machine. I want my perl program to call an installation script and provide parameters to that script such that I do not have to enter 'yes', 'no', 'continue', create directory?', etc, from the command line. I want to fully automate the installation process without much user interaction via keyboard. I need help. Thanks
E.g.
Perl Syntax (Toggle Plain Text)
system "cp", "foo", "bar";
See http://www.unix.org.ua/orelly/perl/p...htm#INDEX-5326
All my posts may be redistributed under the GNU Free Documentation License.
•
•
Join Date: Nov 2005
Posts: 3
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by Rashakil Fol
To call another program with parameters, you will want to pass a list of parameter strings to the 'system' function.
E.g.
Perl Syntax (Toggle Plain Text)
system "cp", "foo", "bar";
See http://www.unix.org.ua/orelly/perl/p...htm#INDEX-5326
Don't be silly. Open the process with a file handle, and you can write data to it that way. For instance:
It will obviously be more complicated than that... but if you change the path and program to your install program, and follow through it step by step, you'll be good to go.
Perl Syntax (Toggle Plain Text)
# /* Open The Program (Just Like A File) Piping Data To It (For Writing) */ open (FH, "| /path2/install/program"); # /* Actually Write To The Process */ print FH "Y\n"; close(FH);
It will obviously be more complicated than that... but if you change the path and program to your install program, and follow through it step by step, you'll be good to go.
![]() |
Similar Threads
- Pseudocode (C++)
- passing parameters in bat file (Visual Basic 4 / 5 / 6)
- passing parameters to a page (JavaScript / DHTML / AJAX)
- Passing Variables/Parameters - By Ref/Value? (Computer Science)
Other Threads in the Perl Forum
- Previous Thread: CGI perl SCRIPT
- Next Thread: Perl/cgi programmer is needed
| Thread Tools | Search this Thread |






