I do have a script which copies files from one box to another.
#!/usr/bin/expect -f
spawn scp "user@host:/opt/xxx/201409080500.tar.bz2" /tmp/dantmp
expect {....
-re ".*es.*no.*"
{
exp_send "yes\r"
exp_continue
}
-re ".*sword.*"
{
exp_send "Pa55word\r"
}
}
interact
Script does a job, but unfortunatelly I am not allowed to use any default bash commands inside. For example like echo
etc, I assume reason is that I haven't imported #!/usr/bin/env bash
. But if I do import it or use bash
together with expect
script is not working at all.
Could you please help me to structure it so I can use both cmd from bash
as well as expected
? Thanks for any help!