kaizar has asked for the wisdom of the Perl Monks concerning the following question:

I m writing a Perl script, which telnets to a linux/Unix machine, but I am not sure what prompt is set for that user, So how do I set The Prompt option in Telnet->new() function to match any prompt character.

Replies are listed 'Best First'.
Re: Setting $telnet->prompt()
by quester (Vicar) on Dec 12, 2008 at 04:48 UTC
    In general there is no way to do that, since the user's prompt could be null, or identical to some of the output from the commands you want to run, or... anything. On the other hand, if the shell is sh or bash-like, you can set PS1 to any string you like to change the prompt:
    weirduser@localhost's password: weirdprompt;-} PS1="my_prompt> " my_prompt>
Re: Setting $telnet->prompt()
by regexes (Hermit) on Dec 12, 2008 at 08:35 UTC
    Hello,

    As another example in addition to questor's: Re: Net::Telnet + command prompt

    regexes



    -------------------------
    Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan "press on" has solved and always will solve the problems of the human race.
    -- Calvin Coolidge, 30th President of the USA.