3

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.

Ole
  • 269
  • 1
  • 3
  • 8
  • I also didn't see anything in the man page for this. It wouldn't surprise me if it couldn't be done. If you can't/don't want to use the `-u` argument for this then you could consider modifying the file at runtime and/or using a here document `lftp -f - < – Etan Reisner Dec 02 '15 at 17:14

2 Answers2

0

If you put this to last line of deploy.scp (*After bye command) :

open -u $FTP_USER,$FTP_PASSWORD $FTP_HOST;

then you can use the following command :

lsftp -f deploy.scp `cat deploy.scp | tail -1`
Madvin
  • 770
  • 9
  • 15
0

You can do

<deploy.scp xargs -l sh -c 'eval echo $0 $*' | lftp

or, to save some typing, make an alias, let's say

alias xv=$'xargs -l sh -c \'eval echo $0 $*\''

and then

xv <deploy.scp | lftp
Armali
  • 18,255
  • 14
  • 57
  • 171