adrivez has asked for the wisdom of the Perl Monks concerning the following question:
my $xs is always empty regardless. To test, i purposely put a fake username and password and i need to obtain the string 'Access denied'. However, my $xs is empty. let's say im running it from cmd prompt and i get this:#!perl use IPC::Open2; my $command = 'plink -ssh -pw password_here username_here@host_name_he +re -batch exit'; print open2(\*CIN, \*COUT, $command); close COUT; my $xs = <CIN>; print "the output is :".$xs; close CIN;
perl test.pl Access denied 3516the output is :
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: assign open2 output to variable
by BrowserUk (Patriarch) on Mar 28, 2014 at 16:58 UTC | |
|
Re: assign open2 output to variable
by ikegami (Patriarch) on Mar 28, 2014 at 17:17 UTC | |
by adrivez (Initiate) on Mar 29, 2014 at 02:09 UTC | |
by ikegami (Patriarch) on Mar 31, 2014 at 16:05 UTC | |
|
Re: assign open2 output to variable
by kcott (Archbishop) on Mar 28, 2014 at 17:30 UTC | |
by MidLifeXis (Monsignor) on Mar 28, 2014 at 17:55 UTC | |
|
Re: assign open2 output to variable
by ikegami (Patriarch) on Mar 28, 2014 at 17:14 UTC | |
|
Re: assign open2 output to variable
by adrivez (Initiate) on Mar 29, 2014 at 07:10 UTC |