in reply to Re^7: Send password in Net::SSH::Expect
in thread Send password in Net::SSH::Expect

Please find below the full output. #ssh-rsa AAAAB3NzaC1yc2 root@HOSTA#gI" /tmp/test.txt']] at ./key.pl li +ne 70.

If that is really, really the (start of the) output of your script, then the hostname (maybe) contains a newline or a carriage return or some other whitespace. Have you really, really checked that your variables contain what you think they do?

If the file contains Windows newlines for example, the output will look as above, as the carriage return left over from the \r\n sequence will move the cursor to the start of the line again.

Replies are listed 'Best First'.
Re^9: Send password in Net::SSH::Expect
by gafaman (Novice) on Jan 23, 2020 at 10:42 UTC
    It is really the (important) part, yes. In full:
    user@host:~/scripts$ ./key.pl Scalar value @hostname_check_arr[1] better written as $hostname_check_ +arr[1] at ./key.pl line 44. Scalar value @words[1] better written as $words[1] at ./key.pl line 50 +. Scalar value @key_check_arr[1] better written as $key_check_arr[1] at +./key.pl line 61. #ssh-rsa AAAAB3NzaC1yc root@EXBOLB4-NO1#gI" /tmp/test.txt']] at ./key. +pl line 70. OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 58: Applying options for *
    I have checked the variables and they seem to be fine, do you have any specific code in hand to clear them from that sort annoyance?
        Thanks, I found something:
        :HOSTA\x{0d}:
        Rest seems find. Working on removing this appendix.