Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 15th, 2006, 8:49 PM   #1
Ryders
Newbie
 
Join Date: Nov 2006
Posts: 3
Rep Power: 0 Ryders is on a distinguished road
bash ftp in function....

this works fine;

        ftp -n $FTP_HOST <<FTP_TERMINATE
        quote USER $FTP_USER
        quote PASS $FTP_PASS
        bye
        FTP_TERMINATE
        exit 0;

whereas this doesn't

checkFtp() {

        ftp -n $FTP_HOST <<FTP_TERMINATE
        quote USER $FTP_USER
        quote PASS $FTP_PASS
        bye
        FTP_TERMINATE
        exit 0;

}

checkFtp;

It's about the << in the ftp connection... but hell I need them! how do I escape them?

anybody has a clue?!

Cheers,

Seb.

Last edited by Ryders; Nov 15th, 2006 at 8:50 PM. Reason: typos..
Ryders is offline   Reply With Quote
Old Nov 15th, 2006, 10:09 PM   #2
Ryders
Newbie
 
Join Date: Nov 2006
Posts: 3
Rep Power: 0 Ryders is on a distinguished road
fixed;

it turns out the FTP_TERMINATE in the function requires to be at the begining of the line (no \t before)

Hope this helps anybody else!

Cheers!

Seb.
Ryders is offline   Reply With Quote
Old Nov 16th, 2006, 4:28 PM   #3
jim mcnamara
Hobbyist Programmer
 
Join Date: Jun 2005
Location: New Mexico
Posts: 228
Rep Power: 4 jim mcnamara is on a distinguished road
look up "here document" on google.
jim mcnamara is offline   Reply With Quote
Old Nov 16th, 2006, 4:50 PM   #4
Ryders
Newbie
 
Join Date: Nov 2006
Posts: 3
Rep Power: 0 Ryders is on a distinguished road
Oh man!

The more I learn about linux bash programming/scripting... the more I love it!

Cheers for your input mate!

Seb.
Ryders is offline   Reply With Quote
Old Nov 16th, 2006, 6:51 PM   #5
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
No substantive post, but I want to commend you for reporting your self-discovered fix for the benefit of the rest of us.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining languages titaniumdecoy Other Programming Languages 12 Jul 13th, 2006 2:03 PM
Compiling Maverik 6.2 (from C) megamind5005 C 16 May 3rd, 2006 5:41 PM
libraries matko C 1 Jan 22nd, 2006 2:12 PM
Jackpot game zorin Visual Basic 3 Jun 10th, 2005 1:19 PM
airport Log program using 3D linked List : problem reading from file gemini_shooter C++ 0 Mar 2nd, 2005 4:12 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:04 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC