I am trying to run lftp with a script like so:
$ lftp -f deploy.scp
However I would like to use environment variables for l/p inside deploy.scp like so:
open -u $FTP_USER,$FTP_PASSWORD $FTP_HOST;
Is that possible in any way? I have struck out finding any help in the man-pages.
Although it requires the additional tool envsubst, this worked for me via process substitution
lftp -f <(envsubst < lftp_commands.txt)
assuming I've set those environment variables and lftp_commands.txt contains something like
open --user $FTP_USER --password $FTP_PASSWORD $FTP_HOST
put example.txt
exit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With