xjlittle has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks!
I am building a script that sets up our servers from a basic install to the correct settings. I have to send this output to an IQ (installation qualification) file.And here is the output and where it stops with the above codeopen (STDOUT, "|tee /var/tmp/IQOQ.txt"); &y_up; ##run yum update sub y_up { my $y = "/usr/bin/yum"; my $u = "update"; system("$y", "$u");
Here is the output with the STDOUT code commented:Transaction Summary ====================================================================== +========== Install 3 Package(s) Update 67 Package(s) Remove 0 Package(s)
How can I set this up so that the required user input is available?Transaction Summary ====================================================================== +============================== Install 3 Package(s) Update 67 Package(s) Remove 0 Package(s) Total download size: 114 M Is this ok [y/N]:
close STDOUT; #close the original STDOUT tee to file open (STDOUT, ">/dev/tty"); #open STDOUT back to just the terminal system("$y", "$u"); #my $rhup = `"$y" "$u"`; my $err = $?>> 8; open (STDOUT, "|tee -ai /var/tmp/IQOQ.txt"); #Now re-tee STDOUT since + we aren't done
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting user input with STDOUT tee to file
by moritz (Cardinal) on Oct 15, 2009 at 18:21 UTC | |
by xjlittle (Beadle) on Oct 15, 2009 at 19:05 UTC | |
by Marshall (Canon) on Oct 15, 2009 at 19:30 UTC | |
|
Re: Getting user input with STDOUT tee to file
by Bloodnok (Vicar) on Oct 15, 2009 at 20:24 UTC | |
by Marshall (Canon) on Oct 17, 2009 at 03:37 UTC | |
|
Re: Getting user input with STDOUT tee to file
by jakobi (Pilgrim) on Oct 15, 2009 at 20:54 UTC | |
|
Re: Getting user input with STDOUT tee to file
by gmargo (Hermit) on Oct 15, 2009 at 23:16 UTC |