Perl's system() function seems to be working great for simple commands
like 'pwd' , 'ls' that does not require user interaction. But when I
try to execute commands that require user input (eg, su or yum while not
on root), then it says 'standard in must be a tty' and fails.
Is this because Perl is not inheriting the standard input properly? Any
ideas on how I can fix it?
Thanks in advance,
Teresa
Mr. Shawn H. Corey wrote:
Teresa Thomas wrote:
Hi,
Its my first time (first day actually!) using Perl and I would like
some help in performing some relatively simple operations.
Welcome to the world of Perl.
My program outputs two columns of text based data. I want to parse
this information, extract some contents and send the contents (which
are actually program names) to yum, to be installed into a Unix machine.
You say "outputs" but you are trying to munge the data. Data that is
outputted cannot be munge. You have to munge it before output.
Currently, I'm extracting the names using "split" command and pushing
the program names into an array. I want to know how to call a command
line utility (like yum or rpm) through Perl. Does this require any
additional libraries?
Showing the piece of code that is giving you problems is a big help.
I think it would be better if you created a script file that contains
all the commands. That way you can pre-view it.
But the command you want is "system". See `perldoc -f system`.
Advice on any alternate/better way of achieving the same would be great!
Thanks,
Teresa
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/