ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
You say that nothing happens. Do you mean that the script does not stop? A loop is not possible, but it can hang (or is waiting for user input).
It could be that you need to change/add a few things, depending on the ftp server you are connecting to.
Things you can try:
- Add passive between quote PASS $PASS and get $FILE,
- Add binary before get $FILE (only needed if you are trying to ftp a binary file),
- Add the -v option to see what is happening (ftp -n -v $HOST).
A few questions if the above doesn't help:
1) Can you post the complete script you are using (except for the user and password, don't edit anything).
2) Is it possible to ftp from the command line using the host/user etc from the file?
3) Are you running linux or unix.
4) What is the output when the -v option is added.
I had to rename a large set of files (around 3000) in around 50 devices that had ftp access. Doing it manually would be no good. So instead I retrieved the directory, used sed to convert it into a script and called it like:
ftp user:pass@host <script
There were many devices to loop through, and I found I needed to add the 'bye' command at the end of the script for it to exit.
As a side note, this doesn't work as advertised if you are using cygwin.
Have you tried the ftp directly from the command line? Does it works? Anyway, why don't you try the bye command instead of quit? Bye is the native command to terminate a session, and it is recognized from all versions of ftp, while quit is not accepted from some of them.