LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 09-23-2004, 02:44 AM   #1
hari_s_82
LQ Newbie
 
Registered: Sep 2004
Posts: 20

Rep: Reputation: 0
Trouble when automating ftp with shell script


Hi,

I wrote a small shell script to automate ftp, something like this

ftp -n <host ip> <<END_SCRIPT
user <user name> <password>
<some ops>
bye
END_SCRIPT

This works fine. But if i give the token "END_SCRIPT" with some indentation like i've given below shell isn't recognizing it????

<some stuff>

if [ 0 = 0 ]
then
ftp -n <host ip> <<END_SCRIPT
user <user name> <password>
<some ops>
bye
END_SCRIPT
fi

<some stuff>


Can anyone tell me why this is happening??????

Thanks,
Hari.
 
Old 09-23-2004, 02:56 AM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,159

Rep: Reputation: 328Reputation: 328Reputation: 328Reputation: 328
This is just the way heredocs work. The end trigger must appears on a line exactly as specified (i.e. no leading tabs/spaces/whatever). As far as I can tell, there isn't any way around this, and yes, it does screw up indentation schemes sometimes.
 
Old 09-23-2004, 03:17 AM   #3
hari_s_82
LQ Newbie
 
Registered: Sep 2004
Posts: 20

Original Poster
Rep: Reputation: 0
Re:

Thanks for the info. Do you know how this is being processed internally by shell. ????

Thanks,
Hari.
 
  


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automating the "killing" process via a shell script fatrandy13 Linux - Software 5 09-14-2007 12:59 AM
automating lynx in a shell script yimboli Programming 15 04-04-2007 03:15 AM
Automating a playlist using shell script... DesiLILO Linux - Newbie 4 04-03-2004 12:03 AM
Trouble in Shell Script Gerardoj Linux - General 6 12-02-2003 10:21 PM
FTP Script (Automating) noodle123 Linux - General 2 10-16-2002 09:17 AM


All times are GMT -5. The time now is 01:38 AM.

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