Continue Processing Bash Script After LFTP
Question
I'd like to use lftp in the beginning of a bash script, but how do I exit lftp without stopping the script from processing? I've tried ending the lftp part with "exit", "quit", and "bye", but they all stop the script.
Previously, I split into two scripts and cron'ed them to run in the right order. Is it possible to combine them into one script?
Solution
Or more explicitly, use << EOF.
e.g.
#!/bin/bash
#CMP 01.04.2013
#
#<<EOF below is the functional equivalent of hitting .Enter. on your keyboard.
#It allows the rest of the commands to be executed once connected
lftp -e 'mirror -R /home/pi/LocalDirToMirror ~/TargetDir' -u YourUsername,YourPassword ftp://FTP_URL_Location <<EOF
quit 0
EOF
OTHER TIPS
End the LFTP part of the script with EOF, on its own line. That's all you need to do!
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow