[lug] question about ftp script...

arnie asherman1 at uswest.net
Mon Dec 13 12:42:24 MST 1999


Hi,
I have a small scripting problem, which I do not understand...

I have a script to automate an ftp transfer which looks like this:
#! /bin/bash
# deliver the file
ftp -i ftp.site.com << EOF
mput $1 $2 $3 $4
bye \n
EOF

This script puts up to 4 files on the ftp server, as expected. It does
not produce any errors.

I have been trying to incorporate this into a script with a menu to
allow for different options. I have a case statement which calls a
function named 'choice_1' which is as follows:

function choice_1 {
        # deliver the file
        ftp -i ftp.site.com << EOF
        mput $1 $2 $3 $4
        bye \n
        EOF
}

If I try to run this function from the menu I get 'syntax error:
unexpected end of file'. If I remove the
<< EOF
then the script logs into the ftp server, but does not execute the
mput.
Anyone know why this would work as a stand alone script, but not as a
function.

I am using the bash shell.
thanks,

--
arnie sherman
frenomulax at bigfoot.com

"Paradise is exactly like where you are right now,
 only much, much better."
        -Laurie Anderson








More information about the LUG mailing list