Took me some time to get there... But i did. For future owners searching for this here it is. The simplest way is to use bgexec scripts. I used the one caeser posted , but there are others online. To launch your code use: bgexec "lftp -f script.txt" callback To catch the response from lftp...