LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices



Reply
 
Search this Thread
Old 05-19-2008, 11:09 AM   #1
kpj104
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 () {

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!

Last edited by kpj104; 05-19-2008 at 11:20 AM. Reason: fast typing caused firefox to submit before I was ready
 
Old 05-19-2008, 11:24 AM   #2
kpj104
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.
 
  


Reply


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 07:53 AM
Bash Script Passing variable to Function nutthick Programming 2 02-02-2005 06:15 AM
search function (bash script) LYK Programming 2 05-27-2004 11:51 AM
C built-in function for a Bash script Linh Programming 3 04-23-2004 10:23 AM
bash - ftp doesn't work within a function richie-451 Programming 3 01-31-2002 02:21 PM


All times are GMT -5. The time now is 08:04 PM.

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