B
bunnytail
Greeting,
I am trying to use Net::Telnet module, however I was stoped by
some strange thing with this tool. In this script, I want to
telnet to a machine(abc), change directory to somewhere and change
current gid to another one using newgrp. But it seems that newgrp is
forbidden to be use in this protocol while in normal shell interaction I
was able to do what I want to do.
any help?
cheers,
h.s
===============================
#!/usr/local/bin/perl -w
$host = "abc";
$prompt = "_funkyPrompt_";
$match = "/" . $prompt . "\$/";
use Net::Telnet;
$telnet = new Net::Telnet ( Timeout=>5,
Prompt => '/abc/',
Errmode=>'return');
print "start\n";
$telnet->open($host);
print "connected\n";
$telnet->login("me","mo");
print "ACL done\n";
$telnet->prompt($match);
$telnet->cmd("set prompt = '$prompt'");
print "setprompt done\n";
@output = $telnet->cmd("ll;pwd");
print @output;
@output = $telnet->cmd("newgrp a_group;pwd");
print @output;
print $telnet->errmsg;
print "\n";
I am trying to use Net::Telnet module, however I was stoped by
some strange thing with this tool. In this script, I want to
telnet to a machine(abc), change directory to somewhere and change
current gid to another one using newgrp. But it seems that newgrp is
forbidden to be use in this protocol while in normal shell interaction I
was able to do what I want to do.
any help?
cheers,
h.s
===============================
#!/usr/local/bin/perl -w
$host = "abc";
$prompt = "_funkyPrompt_";
$match = "/" . $prompt . "\$/";
use Net::Telnet;
$telnet = new Net::Telnet ( Timeout=>5,
Prompt => '/abc/',
Errmode=>'return');
print "start\n";
$telnet->open($host);
print "connected\n";
$telnet->login("me","mo");
print "ACL done\n";
$telnet->prompt($match);
$telnet->cmd("set prompt = '$prompt'");
print "setprompt done\n";
@output = $telnet->cmd("ll;pwd");
print @output;
@output = $telnet->cmd("newgrp a_group;pwd");
print @output;
print $telnet->errmsg;
print "\n";