If you cannot compute an arithmetic formula to list all the IP addresses, just list them all in the for statement:
Code:
for ip_address in 10.xx.3.131 10.xx.32.3 10.xx.31.32
do
ftp -ni $ip_address <<-EOS
user getin searchin
binary
lcd $wd
cd $dir
put $file
bye
EOS
done
If you have them stored in a file (e.g. iplist) just pass the output of cat to the for statement:
Code:
for ip_address in $(cat iplist)
do
Quote:
Originally Posted by visitnag
what is <<-EOS?
|
Take a look at the section of the Advanced Bash Scripting Guide I linked in my previous post and it will be clear. The EOS is a custom string (you can chose any string at your pleasure). The input to the file (that is the here document) will terminate as soon as the string is encountered (see the matching EOS at the end of the ftp commands). Regarding the hyphen, here is an excerpt from the aforementioned guide:
Quote:
The - option to mark a here document limit string (<<-LimitString) suppresses leading tabs (but not spaces) in the output. This may be useful in making a script more readable.
|