LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   bash script with ftp in a function -- please help! (https://www.linuxquestions.org/questions/linux-general-1/bash-script-with-ftp-in-a-function-please-help-643246/)

kpj104 05-19-2008 10:09 AM

bash script with ftp in a function -- please help!
 
Hi! I've been googleing and searching all over the place, but have yet to find a solution. I consider myself a pretty advanced bash script writer, but I am stumped here. I am trying to get an automated ftp session built into a function. I can use code within the main script, but as soon as I enclose it in a function I receive "unexpected end of file"

ftp_one () {

strAction=$1
strDir=$2
strFile=$3

ftp -ivn nas2 <<EOFtp
USER admin password
cd ${strDir}
bin
hash
${strAction} ${strFile}
bye
EOFtp

}

fn_one get /etc/ approve

If anyone can help, I'd be appreciative!

kpj104 05-19-2008 10:24 AM

OK figured out my own answer. I had EOFtp indented and it can not be. Once I removed all tabs/spaces in front of it, this worked.


All times are GMT -5. The time now is 06:54 AM.