Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Bash / Shell Scripting (http://www.programmingforums.org/forum26.html)
-   -   bash ftp in function.... (http://www.programmingforums.org/showthread.php?t=11900)

Ryders Nov 15th, 2006 8:49 PM

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.

Ryders Nov 15th, 2006 10:09 PM

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.

jim mcnamara Nov 16th, 2006 4:28 PM

look up "here document" on google.

Ryders Nov 16th, 2006 4:50 PM

Oh man!

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

Cheers for your input mate!

Seb.

DaWei Nov 16th, 2006 6:51 PM

No substantive post, but I want to commend you for reporting your self-discovered fix for the benefit of the rest of us.


All times are GMT -5. The time now is 8:16 PM.

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