I am wondering if ksh is capable of reading in a list of hostnames and then ftp'ing a file to each host in the same directory?
If I have a file called hosts.lst and then just run and ftp loop reading in each line of hosts.lst.
I have the following ,but it's reading the whole file:
#!/usr/bin/ksh
user="root"
HOSTS="/home/dcasey/hosts.lst"
HOSTS="`cat /home/dcasey/hosts.lst`"
for i in "$HOSTS"; do
echo ftp -v -n $i << EOF
user $user
cd /home/user01/logs
lcd /home/user02
bin
hash
put file.tar
quit
EOF
done
If I have a file called hosts.lst and then just run and ftp loop reading in each line of hosts.lst.
I have the following ,but it's reading the whole file:
#!/usr/bin/ksh
user="root"
HOSTS="/home/dcasey/hosts.lst"
HOSTS="`cat /home/dcasey/hosts.lst`"
for i in "$HOSTS"; do
echo ftp -v -n $i << EOF
user $user
cd /home/user01/logs
lcd /home/user02
bin
hash
put file.tar
quit
EOF
done