Chris,
--- "Vidal, Christopher, SOLCM" <[EMAIL PROTECTED]> wrote:
> Using the Telnet.pm mod, How do I put my unix prompt into the PROMPT
> scalar ?
>
> My unix profile prompt is :
>
> uid=`whoami`
> system=`hostname`
> PS1=$system" "$uid" "\\!:" "
>
> #! /opt/perl5/bin/perl
> require '/tools/mns/bin/Telnet.pm';
> #
> $username = "wannabperlguy" ;
> $passwd = "needslotsahelp";
> $t = new Net::Telnet (Timeout => 10,
> Prompt => '`hostname`" "`whoami`);
> $t->open("1.2.3.4");
> $t->login($username, $passwd);
> @lines = $t->cmd("/usr/bin/who");
> print @lines;
I don't think you can do command substitution like this. Maybe if it was
done before the compile stage (dunno).
Try using a literal string. Example, I used this string to log in to 450
different servers (each had a the server name embedded in the prompt,
s0001u01, s0002u01, s0003u01, etc):
$t = new Net::Telnet (
Timeout => 15,
Prompt => '/\([EMAIL PROTECTED]):.*> $/' );
Note: special perl characters MUST be espcaped (as in the above). You can
use '.' for single character substitution, and '*' for multiple characters
(as you might expect). Note too that the trailing '$' above signifies
end-of-string that telnet.pm will scan to indicate you're at a prompt (ie, my
prompt might be: "([EMAIL PROTECTED]):/local/usr/apps > ".
You're missing the '/' to indicate your prompt string set, and the final '$'.
Concatenate the variables you want into a single variable and do something
like
Prompt => '/$myPrompt$/' );
HTH,
JW
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]