Results 1 to 2 of 2
Hey Bash-Scripters, maybe you can help me...?
I've been trying to make automated ftp bash scripts, but somehow i can't figure out how it works...
First i've tried to create ...
- 04-13-2010 #1Just Joined!
- Join Date
- Apr 2010
- Posts
- 3
Automated FTP...?
Hey Bash-Scripters, maybe you can help me...?
I've been trying to make automated ftp bash scripts, but somehow i can't figure out how it works...
First i've tried to create an script, that opens a ftp connection:
When i execute this script it stops after the commandCode:#!/bin/bash -xv HOSTNAME="192.168.178.20" USERNAME="media" PASSWORD="media" ftp -n -v $HOSTNAME ascii user $USERNAME $PASSWORD get movie5.avi bye
it is waiting for further input.Code:ftp -n -v $HOSTNAME
When I extend the line that makes script stop with <<EOT It will work
<- that works!!!Code:ftp -n -v $HOSTNAME <<EOT
I do not understand what the <<EOT is making (EOF is also functioning) Why?
Then I've tried to test the script inside an if statement
This code returns the error:Code:#!/bin/bash -xv HOSTNAME="192.168.178.20" USERNAME="media" PASSWORD="media" if [ -e "movie5.avi" ]; then echo "movie is here, do not download" else ftp -n -v $HOSTNAME << EOT ascii user $USERNAME $PASSWORD get movie5.avi bye fi
here-document at line 10 delimited by end-of-file (wanted `EOT')
when I remove the "EOT", the script is stopping than before.
I don't understand why it does not work, I hope u can help me!!!
All the best
- 04-13-2010 #2Linux Guru
- Join Date
- Nov 2007
- Posts
- 1,695
Google/Forum Search > bash ftp script


Reply With Quote