3

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?

Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214
Nathan
  • 766
  • 2
  • 9
  • 19

2 Answers2

3

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
CMP
  • 1,170
  • 12
  • 11
0

End the LFTP part of the script with EOF, on its own line. That's all you need to do!

Nathan
  • 766
  • 2
  • 9
  • 19