ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am writing a script to do a speed measurement from my ISP's test ftp server. To do this interactively I connect to the server, enter credentials, enable hash and download a test file. The process concludes with something like
Quote:
################################################################
226 Transfer complete.
1048576 bytes received in 2.87 secs (356.6 kB/s)
So I entered the credentials for the server in my .netrc file and created a little bash script as follows
Quote:
#!/bin/bash
cd ~/Desktop
# poiuytrewq is the limit string of the "here" document
ftp 63.162.xxx.xxx <<poiuytrewq
hash
get test.1meg
bye
poiuytrewq
The script executes as expected EXCEPT that I do not see the statistics at the end of the transfer. It terminates thusly
I have tried adding another ftp command such as ls to the end of the "here" document (in case the results were clipped by the bye command) but to no avail. The ls result immediately follows the ### - no stats I am at a loss. Any suggestions from the community?
I added -v (verbose) to the ftp command. I get a bunch of other data which I do not want but I do get the stats I am looking for at the end of the process.
I will leave this thread open to see if someone else has a better idea.
Thanks again,
Ken
Last edited by taylorkh; 02-05-2010 at 04:36 PM.
Reason: more info
I have played with wget in the past - don't remember why. If I am in a real hurry to download something I use Internet Download Manager in an XP virtual machine. It will suck every possible bps from my DSL connection. It will queue many jobs, download all links from a web page, restart downloads etc. I think I looked into wget when I could not get IDM to work under wine. I now have enough horsepower (i7-860 CPU and 8 GB of RAM) to run a virtual machine all the time just in case I need do run a Windows program.
For the purposes of my speed test script - it does what I need. When something seems really slow (as Ubuntu updates were this morning) I can simply fire up the script and get a quick read on my connection throughput.
The problem might be that a script is running in a non interactive shell
you can try if adding a i to the first line #!/bin/bash -i to force a interactive shell
solves your problem, or add a ! to ftp ! 63.162.xxx.xxx to invoke a interactive shell.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.