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
To call another program with parameters, you will want to pass a list of parameter strings to the 'system' function.
E.g.
system "cp", "foo", "bar";
See http://www.unix.org.ua/orelly/perl/prog3/ch29_02.htm#INDEX-5326
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
Don't be silly. Open the process with a file handle, and you can write data to it that way. For instance:
# /* 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.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215