Need help writing a script
I need a simple script to do some testing and I'm in a bit of a hurry. Normally I'd read up on it so as to "learn to fish". But I don't think I have time for that right now so I'm hoping someone can "give me a fish"; if you know what I mean.
I'm doing some network testing and need to put some real world traffic on the network. I thought of having two pc's, one with an FTP server and another getting a file off the server. I imagine this would be a simple bash script that would do the following at the client: 1. Get a file from the FTP server. 2. When done, delete the file and go back to step 1. (and repeat forever) That's it! Not knowing much about bash, is this something simple? Can commands be pushed into FTP tp perform such functions from bash? Let me know if someone can help. BS |
You can use the expect command to do this, in fact scripted FTP sessions is one of the most common usages for expect.
It is *very* simple to start out with it. Either simply google a bit, or use the autoexpect script that comes with it to create a script automatically (it catches input and output and creates a script). You can then call this script from a bash script in a loop of some sort. Håka |
Oh, and another solution would be using wget. Probably even simpler:
Code:
#!/bin/bash Håkan |
Thank you very much for writing the script out for me. In the spirit of learning I will check out the reference to "expect", but appreciate your assistance.
BS |
All times are GMT -5. The time now is 12:38 PM. |