Skip to content
Advertisement

Facing issues writing code with perl expect

I want to run a command which will connect to a remote host and perform some actions, while I try to run the command below actions are required.

JavaScript

also it asks for a password as below

JavaScript

I have written a perl script as below:

JavaScript

I needed a code which can answer the questions asked on console i.e. as below and also the password console

JavaScript

I am not sure on the mistake I have done regarding the script, can someone please help ?

Problem is – I think the “yes” that needs to be typed for below query is not taken because of which the query “Please type ‘yes’ or ‘no’: ” is shown on console. Then my script stops there and does not proceed with password prompt.

Are you sure you want to continue connecting (yes/no)?

Advertisement

Answer

I changed the code as below, it was successful:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement