I have written a small script to download files from an FTP to external drive that is connected to my Raspberry Pi 3B+. I am using rsync to download my files. Here are the scripts:
download.sh:
#!/bin/bash
sudo rync -P -r -e ssh user@host:/path/* /local/directory
To process password, I have password.sh:
#!/usr/bin/expect
spawn ./download.sh
expect "password: "
send -- "mypassword"
expect eof
When I run password.sh, it logs into the FTP and file transfer starts, but after 5-6 seconds the program terminates without any error and the file download stops. Is there any way to keep the script running until all downloads are finished? Any help will be really appreciated.