On 10/14/2011 08:41 AM, Gary D Walborn wrote:
> Well, it reinforces my belief that you can only set and clear
> variables that are already defined (i.e., no user-defined
> variables). I researched the mail archive and found nothing
> to suggest anything different.
Hi Gary. Welcome to lftp.
I have the same need as you, and have done the same research,
with the same result, and ...
> It is possible to work around the lack of same (by using
> a bash script to WRITE an lftp script)
... I ended up with two work-arounds, one of which is like what
you suggested.
For some very specific cases, I have a template lftp script,
and a wrapper bash script that replaces tokens in the template
with text based on values determined at the time the bash script
is run.
In most cases I've run into, however, it turns out that the
variable data is the filename being uploaded or downloaded,
and I can deal with that by (i) using file globbing (for which
lftp has native support) and (ii) doing the file management
apart from lftp before/after the file transfer. ...
> To give you an idea of just ONE application, I need to call
> lftp to send a file each day and the name of the file changes
> every day.
... So, in this case, I would have :
1) a bash script that puts today's file where lftp sees it,
2) and then calls the lftp command
3) an lftp script that uses a file glob
4) the same lftp script !mv the file aside when done
5) the bash script from #1 and #2 post-process the mv'd file
e.g. :
bash script sets TODAY=`date '+%Y-%m-%d'`
bash script mv's xyzdata-$TODAY from /var/xyz/gen to /var/xyz/upload
bash script calls lftp script which contains:
...
mput /var/xyz/upload/xyzdata-*
!mv /var/xyz/upload/xyzdata-* /var/xyz/sent
...
bash script mv's xyzdata-$TODAY from /var/xyz/sent into, say,
/var/xyz/archive/$YEAR/$MONTH
(The ! is lftp's shell-out metacharacter.)
This uses the idea of a bash script to wrap the lftp step, without
needing to have the bash script write the lftp script.
I agree that built-in support of variables would be a great
addition to lftp, but is a non-trivial undertaking. Working
around it by letting the things that are already good at dealing
with variables (in all the crazy ways that people end up doing
so in the real world) provide that support seems more than
sufficient to me, so far.
I also agree with the many people who have posted to this list
that lftp is a superb utility, and a true asset because of
all the things it does support.
Again, welcome to lftp. Soon you will find it indispensable.
--
Andrew Witt
Manager, Operational Engineering
revol wireless
216-525-1195 desk
216-816-6164 wireless
216-525-1112 fax
[email protected]
www.revol.com
THIS MESSAGE IS INTENDED ONLY FOR THE USE OF THE INDIVIDUAL OR ENTITY TO WHICH IT IS ADDRESSED AND MAY CONTAIN INFORMATION THAT IS PRIVILEGED, CONFIDENTIAL, AND EXEMPT FROM DISCLOSURE UNDER APPLICABLE LAW. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution, forwarding, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by e-mail or telephone, and delete the original message immediately.
_______________________________________________
lftp mailing list
[email protected]
http://univ.uniyar.ac.ru/mailman/listinfo/lftp