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, 01: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, 01:56 AM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
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, 02: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-13-2007 11:59 PM
automating lynx in a shell script yimboli Programming 15 04-04-2007 02:15 AM
Automating a playlist using shell script... DesiLILO Linux - Newbie 4 04-02-2004 11:03 PM
Trouble in Shell Script Gerardoj Linux - General 6 12-02-2003 09:21 PM
FTP Script (Automating) noodle123 Linux - General 2 10-16-2002 08:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:25 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
Open Source Consulting | Domain Registration