Anyone can help me what will be the problem? login name and password is from .netrc. , < before example.script wont work
#!/bin/bash
HOST='192.163.3.3'
FILE="a.txt"
while :; do
ftp -p -v -i $HOST << example.script >> a.log
grep -qF "Connected" a.log &&
grep -qF "File successfully transferred" a.log && break
done
exit 0
example.script contains
put $FILE
quit
And the error is:
./example.sh: line 15: syntax error: unexpected end of file
I got this while I'm using sh -vx on my script:
while :; do
ftp -p -v -i $HOST < example.script >> a.log
grep -qF "Connected" a.log &&
grep -qF "File successfully transferred" a.log && break
done
+ :
+ ftp -p -v -i 192.163.3.3
+ grep -qF Connected a.log
grep: a.log: No such file or directory
+ :
+ ftp -p -v -i 192.163.3.3
+ grep -qF Connected a.log
grep: a.log: No such file or directory
+ :
Note that this code fixes the problem (using < instead of << for the input redirection). The script file is given as exaple.script instead of example.script.
#!/bin/bash -vxwhen debugging it.> a.log 2>&1and you might want to usencftporwgetorcurl