Can the expect utility handle a case where the process it spawns also spawns a sub process?
- by davidparks21
I'm trying to use expect to handle rsync over an ssh shell, but it gets stuck.
If I run my rsync command it works (simplified here): It prompts me for my password and copies files to the server:
rsync -e ssh -<other_params>
If I then enclose that in expect:
expect -d -c "spawn rsync -e ssh -<other_params>" -c "expect password:" -c "send mypass\r"
It does not execute properly, the program exists and no files are copied. Even the debug mode isn't giving many clues.
My best guess is that rsync is spawning the ssh process, and the ssh process is what needs to be interacted with, but send is picking up the rsync process id and sending the input there.
Any thoughts?