So I have seen multiple posts on this and maybe I just haven't seen the right one.
I am using an expect script to scp multiple files from my locale to a remote. I dont want to set up keys for passwordless logins, because then the servers cant be blown away and stood up with out more work, yes I could automate the key creation, I would just rather not. So I want to be able to use the * but every time I use the * it tells me. The reason I want to use * instead of a full name is because the version number will keep changing and I dont want to go manually change the script every time.
/path/{Install.sh,programWithVerionAfter*\}: No such file or directory
Killed by signal 1.
I am hoping that this is an easy fix or workaround. All I would like to do is scp these files so I can automate an install process with the click of a button. Thankyou in advance for any help
#!/usr/bin/expect -f
spawn scp /path/\{Install.sh,programWithVerionAfter*\} "root@IP:/tmp/.
expect {
-re ".*es.*o.*" {
exp_send "yes\r"
exp_continue
}
-re ".*sword.*" {
exp_send "Password\r"
}
}
interact
In Unix, you can use SCP (the scp command) to securely copy files and directories between remote hosts without starting an FTP session or logging into the remote systems explicitly. The scp command uses SSH to transfer data, so it requires a password or passphrase for authentication.
I found what I wanted with much more googleing. Thankyou for your help, hope this helps others
http://www.linuxquestions.org/questions/linux-general-1/scp-with-wildcard-in-expect-834813/
#!/usr/bin/expect -f
spawn bash -c "scp /path/* root@IP:/tmp/"
expect {
-re ".*es.*o.*" {
exp_send "yes\r"
exp_continue
}
-re ".*sword.*" {
exp_send "Password\r"
}
}
interact
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With