please advice why spawn  scp  $FILE1   $FILE2  $LOGIN@$IP:/tmpin my expect script copy only FILE1 and not copy FILE2 ?I try to to transfer both files by scp  as scp file1.csv file2.crt 192.8.200.1:/tmp without expect  and they transferred successfully to /tmpso why VIA expect the only file that copied is FILE1 ?? what wrong in my syntax ?example of my expect script: #!/usr/bin/expect -f set FILE1  file1.csv set FILE2  file2.crt set multiPrompt {[#>$]} spawn  scp  $FILE1   $FILE2  $LOGIN@$IP:/tmp           expect {                     )?   { send yes\r  ; exp_continue  }                    word:  {send $PASS\r}                   }I also try this:spawn  scp  $FILE1   $FILE2   $LOGIN@$IP:/tmpORspawn  scp  '$FILE1   $FILE2'   $LOGIN@$IP:/tmpbut I get the same problem
How to copy two files in expect script?
bash;expect
I've written the following expect script for this, and it works (on my vms).Sample run:./scp.exp <first host user> <first host user pass> <first host name> <second host name> <second host user> <second host user pass> <directory path i.e. /tmp>Script:#!/usr/bin/expect -f# ./sshlogin.exp uptime# set Variablesset user [lindex $argv 0];set password [lindex $argv 1];set host [lindex $argv 2];set copy_to_host [lindex $argv 3];set copy_to_host_user [lindex $argv 4];set copy_to_host_pass [lindex $argv 5];set copy_to_host_dir [lindex $argv 6];set file1 one.txt;set file2 two.txt;set timeout 10# now sshspawn ssh $user@$host -o StrictHostKeyChecking=nomatch_max 100000 # Look for passwod promptexpect *?assword:*# Send password aka $passwordsend -- $password\r# send blank line (\r) to make sure we get back to guiexpect *$ send -- scp -o StrictHostKeyChecking=no $file1 $file2 $copy_to_host_user@$copy_to_host:$copy_to_host_dir\rexpect *?assword:*send -- $copy_to_host_pass\rexpect *$  send -- exit\rexpect eofNote: you might need to add some wait time to expect if dealing with large files.