简体   繁体   中英

Environment variables in LFTP script

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.

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`

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM