Computing.Net > Forums > Unix > script error using ftp -v -n <<EOF

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

script error using ftp -v -n <<EOF

Reply to Message Icon

Name: Dave Alva
Date: March 12, 2002 at 12:43:34 Pacific
Comment:

The main body of this script works as expected when not written as a function.
When the script is written as shown below, the line "ftp -v -n <Does anyone know the proper syntax to write the line. I think it has something to do with possibly using the single quote, double quote, backslash or back quote charaters?

Thanks,
Dave

#!/bin/sh
# script1
# 2/19/02 by da
# This script moves a data file from Computer1 to Computer2


ftpit()
{
cp /home/jdoe/tmplun1/test1 /home/jdoe/tmplun1/junk99
ftp -v -n < open computer2
user xxxx pppp
cd /home/jdoe
!cd /home/jdoe/tmplun1
put junk99
close
quit
exit
cd /home/jdoe
}


if [ -s test1 ]
then
ftpit
fi



Sponsored Link
Ads by Google

Response Number 1
Name: Dave Alva
Date: March 12, 2002 at 12:50:32 Pacific
Reply:

This is a correction to my original posting. The line should read "ftp -v -n < ftp -v -n < open computer2
user xxxx pppp
cd /home/jdoe
!cd /home/jdoe/tmplun1
put junk99
close
quit
exit


0

Response Number 2
Name: Paulo Alves Vieira
Date: March 13, 2002 at 05:17:42 Pacific
Reply:

Hello Dave !

The correct mode is:


ftpit()
{
cp /home/jdoe/tmplun1/test1 /home/jdoe/tmplun1/junk99
ftp -iv << EOF
open computer2
user xxxx pppp
cd /home/jdoe
lcd /home/jdoe/tmplun1
put junk99
close
quit
exit
cd /home/jdoe
EOF
}


if [ -s test1 ]
then
ftpit
fi

Let me know if everything is OK.


Paulo Alves Vieira



0

Response Number 3
Name: Paulo Alves
Date: March 14, 2002 at 10:21:06 Pacific
Reply:

David,

I tested your script in my server and I discovered the problem.
The word EOF is obligatory and has a positional field. Then put the word EOF at first field like the example.
After your test, please, e-mail me.

I wrote the original script ( in blue letters ) and fixed ( in red letters), look !!!


ftpit()
{
cp /home/jdoe/tmplun1/test1 /home/jdoe/tmplun1/junk99
ftp -v -n < open computer2
user xxxx pppp
cd /home/jdoe
!cd /home/jdoe/tmplun1
put junk99
close
quit
exit
cd /home/jdoe
EOF
}


if [ -s test1 ]
then
ftpit
fi


Paulo Alves Vieira
Cartão Unibanco - Arquitetura Técnica
F: 3789-7024 - CAU C2


0

Response Number 4
Name: Peter4u
Date: March 16, 2002 at 14:06:52 Pacific
Reply:

Hi folks,

The construct which is used here is called "HERE DOCUMENT".

This means that everything that comes between the "beginning marker" and the "end marker" is treated as if it would be keyed in directly on the terminal.

The "beginning marker" has always the form: lt-sign lt-sign keyword

and the "end marker" is just the
keyword


Typically the keyword is EOF but other words are also possible.


(The lt-sign doesn't work well, if I enter it in this amilbox, for that reason I just used the words, but you have to use the sign, which spells in HTML as & l t ; "<" and is on my us-keyboard on Shift-comma)


0

Response Number 5
Name: sanjay rawal
Date: July 16, 2002 at 15:51:19 Pacific
Reply:

I want to do ftp by using shell script, presently it is working.
but I want to do
ftp -n -i password mput etc..
as a single line command
I do not want to on next line...


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

somebody is looking my fi... hmmmm



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: script error using ftp -v -n &lt;&lt;EOF

ftp / unix script www.computing.net/answers/unix/ftp-unix-script/4644.html

running unix scripts remotely using www.computing.net/answers/unix/running-unix-scripts-remotely-using/3762.html

ftp from Unix to Windows NT www.computing.net/answers/unix/ftp-from-unix-to-windows-nt/4959.html