If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > "Automated" FTP script prompting for password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-31-05, 13:08
bluwulf bluwulf is offline
Registered User
 
Join Date: Oct 2004
Posts: 31
"Automated" FTP script prompting for password

Why is it whenever I use this I get prompted for password

Code:
FTP_OUTPUT=$(/usr/bin/ftp -i -v -n $FTP_HOST_ADDRESS <<END_FTP
user $FTP_HOST_USERNAME $FTP_HOST_PASSSWORD
$FTP_TRANSFER_TYPE
lcd $PATH_TO_DUMPEDFILES_DIR
cd $PATH_TO_PUT_DUMPED_FILES_ON_HOST
put $file_to_ftp
quit
END_FTP)


And whenever I do this:

Code:
/usr/bin/ftp -i -v -n $FTP_HOST_ADDRESS <<END_FTP
user $FTP_HOST_USERNAME $FTP_HOST_PASSSWORD
$FTP_TRANSFER_TYPE
lcd $PATH_TO_DUMPEDFILES_DIR
cd $PATH_TO_PUT_DUMPED_FILES_ON_HOST
put $file_to_ftp
quit
END_FTP
I get the following error :


./myscript.ksh[89]: syntax error at line 190 : `<<' unmatched


On line 89 I have this :

Code:
/usr/xpg4/bin/ls -ltr $PATH_TO_FILES/$file_to_look_for | /usr/xpg4/bin/awk '{print $9}' | while read path_to_found_file
On line 190 I have this :

Code:
/usr/bin/ftp -i -v -n $FTP_HOST_ADDRESS <<END_FTP

I really don't understand the above error, there is nowhere else in the script where I'm using << except on line 190 (there are no other >> in the script). I have also went through and counted all the ` they all "add-up".

Last edited by bluwulf; 10-31-05 at 16:16.
Reply With Quote
  #2 (permalink)  
Old 11-02-05, 06:46
ducasio ducasio is offline
Registered User
 
Join Date: Aug 2004
Location: Rome, Italy
Posts: 81
use this and maybe it'll work

-----------------------------------------------
FTP_OUTPUT() {
{
echo "open $FTP_HOST_ADDRESS"
echo "user $FTP_HOST_USERNAME $FTP_HOST_PASSSWORD"
echo "$FTP_TRANSFER_TYPE"
echo "lcd $PATH_TO_DUMPEDFILES_DIR"
echo "cd $PATH_TO_PUT_DUMPED_FILES_ON_HOST"
echo "put $file_to_ftp"
echo "quit"
} | ftp -nvi
}

FTP_OUTPUT
-----------------------------------------------------
I hope it works,
bye by ducasio
Reply With Quote
  #3 (permalink)  
Old 11-03-05, 00:00
bluwulf bluwulf is offline
Registered User
 
Join Date: Oct 2004
Posts: 31
I kno where I wuz being prompted for a password...my password variable was splet wrong it is suppoze to be $FTP_PASS_WORD not $FTP_PASSS_WORD. I corrected, that but I still get this error :

Code:
./myscript.ksh[89]: syntax error at line 190 : `<<' unmatched
I however prefer to use :


Code:
FTP_OUTPUT=$(/usr/bin/ftp -i -v -n $FTP_HOST_ADDRESS <<END_FTP
user $FTP_HOST_USERNAME $FTP_HOST_PASSWORD
$FTP_TRANSFER_TYPE
lcd $PATH_TO_DUMPEDFILES_DIR
cd $PATH_TO_PUT_DUMPED_FILES_ON_HOST
put $file_to_ftp
quit
END_FTP)
because I want the output of the FTP process to be assigned to the $FTP_OUTPUT
variable for further use....it actually works now. Thanks for your insight though.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On