[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Script of the ftp



Márcio Luciano Donada wrote:
> This is for the snakes in scripts.

In this context what are "snakes in scripts"?

> I am making one scripts that it uses the bow will be for sending
> archives of different varios directory for ftp, only that I am
> having a problem of
> 
> My scripts is:
> 
> !/bin/bash
> users=`ls /home/relatorios/`
> for user in $users; do
>     cd /home/relatorios/$user
>     ftp -n 200.228.43.6<<End-Of-Session

You are starting a here-document with "<<End-Of-Session".  This will
place all content in the file until "End-Of-Session" as stdin to the
'ftp' command on that line.

>     user blablablabla "blabla"
>     bin
>     prompt
>     cd /home/$user/ARQUIVOS
>     bye
>     EOF

What is "EOF" there?

> done
>
> erro is: end of file expetend,

The script never finds "End-Of-Session" and so runs into the end of
the file.  That is an error.  Fix your here-document.

Also, with ftp the 'prompt' command toggles and may be making it
interactive.  In these cases it is usually better to use the 'ftp -i'
option instead to force a known state.

Bob



Reply to: