0

I am new to expect scripting, I have a case where I need to run a script on a on a server that contains our backups that will send a command to my firewall device that will send a backup to an internal FTP server. My snippet is

#!/usr/bin/expect
set PASS="password"
spawn ssh admin@10.3.0.1 -p 4118   #Firewall Device IP
expect "Password:" 
send "$PASS\r"

For some reason when running this small snippet of code by itself it still asks for a password to be entered.

I applied the changes suggested by Joao Vitorino, it' no longer asking for a password but it is throwing these errors:

   TEST.sh: spawn: not found
   TEST.sh: expect: not found
   TEST.sh: send: not found
Angus
  • 17
  • 4

1 Answers1

0
#!/usr/bin/expect
set PASS "password"
spawn ssh admin@10.3.0.1 -p 4118   #Firewall Device IP
expect "password: " 
send "$PASS\r"

Set must to be use like "set varname varValue". No equal (=) symbol

Joao Vitorino
  • 2,976
  • 3
  • 26
  • 55