[TriLUG] Perl. Help. Needed.

Greg Brown gwbrown1 at gmail.com
Wed Mar 11 16:08:12 EDT 2009


Ah...

printing to stdout
tclsh
rtpndsefwl5324d2(tcl)#AGAIN!!!! printing to stdout

So when STDOUT is redirect in Perl the prints to $ssh end up in the output
file and not sent to the Expect module.  Interesting.

Yeah, I'm going to have to figure out a way to assign a CONFIG handle to
that one $ssh->expect command and grab that from there.

On Wed, Mar 11, 2009 at 3:52 PM, William Sutton <william at trilug.org> wrote:

> Hmm... so print CONFIG the stuff you want in the CONFIG file, print STDERR
> the stuff you want on your screen, and let Expect use STDOUT?
>
> William Sutton
>
>
> On Wed, 11 Mar 2009, Greg Brown wrote:
>
>  Hum... and when you redirect STDOUT it appears that the expect commands
>> stop
>> communicating from the script to the Expect.pm process.  Interesting.
>>
>> On Wed, Mar 11, 2009 at 3:42 PM, Greg Brown <gwbrown1 at gmail.com> wrote:
>>
>>  Yes, that's true, I could do that but that would capture the entire
>>> output
>>> for the script which is quite involved; capturing only the desired output
>>> would be much more clean.
>>>
>>> But I'm about ready to write some "------MARK------" lines into the file
>>> and strip out everything outside those marks.
>>>
>>> But that's a last resort.  This can be done.. somehow.
>>>
>>> Greg
>>>
>>>
>>> On Wed, Mar 11, 2009 at 3:38 PM, <shawn.taylor at gpi.com> wrote:
>>>
>>>  I am by no means a perl or expect guru, but why can't you do something
>>>> like:
>>>>
>>>> ./script.pl > myfile.out
>>>>
>>>> Since the script uses the expect module, there should be no required
>>>> user
>>>> interaction no?
>>>>
>>>> Shawn
>>>>
>>>> Greg Wrote:
>>>>
>>>> Let me step back and take a breather.. how do I redirect the output of
>>>> this
>>>> command:
>>>>
>>>> print $ssh "exec \"show run\"\r";
>>>>
>>>> I think I've tried everything.  I'm open to any and all suggestions.
>>>> --
>>>> TriLUG mailing list        :
>>>> http://www.trilug.org/mailman/listinfo/trilug
>>>> TriLUG FAQ  : http://www.trilug.org/wiki/Frequently_Asked_Questions
>>>>
>>>>
>>>
>>>  --
>> TriLUG mailing list        :
>> http://www.trilug.org/mailman/listinfo/trilug
>> TriLUG FAQ  : http://www.trilug.org/wiki/Frequently_Asked_Questions
>>
>>  --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG FAQ  : http://www.trilug.org/wiki/Frequently_Asked_Questions
>



More information about the TriLUG mailing list