Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 05-19-2008, 10:09 AM   #1
LQ Newbie
Registered: Mar 2006
Posts: 4

Rep: Reputation: 0
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 () {


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


fn_one get /etc/ approve

If anyone can help, I'd be appreciative!

Last edited by kpj104; 05-19-2008 at 10:20 AM. Reason: fast typing caused firefox to submit before I was ready
Old 05-19-2008, 10:24 AM   #2
LQ Newbie
Registered: Mar 2006
Posts: 4

Original Poster
Rep: Reputation: 0
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Split function (bash script) NiM Programming 11 03-10-2012 06:53 AM
Bash Script Passing variable to Function nutthick Programming 2 02-02-2005 05:15 AM
search function (bash script) LYK Programming 2 05-27-2004 10:51 AM
C built-in function for a Bash script Linh Programming 3 04-23-2004 09:23 AM
bash - ftp doesn't work within a function richie-451 Programming 3 01-31-2002 01:21 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:05 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration