Hi guys,
i need to script the sending of multiple files through one ftp session. I have done this so far:
----------------------------------------------------------------
#!/bin/sh
USER=myuser
PASSWD=mypass
filenum=$1
x=0
ftp -n 159.167.95.199 <<SCRIPT
user $USER $PASSWD
binary
while [ $x -lt $filenum ]
do
cd pacsftp01
put test.txt
delete test.txt
x=`expr $x + 1`
done
quit
echo $x files transferred
SCRIPT
--------------------------------------------------------------------
questions:
How can i execute a while loop within the ftp sessions?
What does "<<SCRIPT" do?
zaff,
You are trying to loop inside the ftp command (everything that you are doing after the << is inside the ftp command) That is not going to work, as ftp does not support these commands.
A better suggestion is to construct a ftp script and feed it to the ftp program.