nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

#why following cannot be execute?

This is a discussion on #why following cannot be execute? within the Shell scripting forums, part of the Development/Scripting category; following script first get target script on ftp server, then execute it. but actually, this script will end after command ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Linux answers from nixCraft.


Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 23-02-2005, 06:26 AM
Junior Member
User
 
Join Date: Feb 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
ryan
Send a message via MSN to ryan
Default #why following cannot be execute?

following script first get target script on ftp server, then execute it.

but actually, this script will end after command line "bye", the statement after it wil not be executed.

what's wrong and how to resolve, I currently seprate it to two scripts, works well but I am not satisfy it.



###########################################Start
#!/bin/bash

filename=$1

ftp -nv <<!
open 10.10.10.10
user anonymous 111@111.com
ascii
get $filename
close
bye
!

#why following cannot be execute?
clear
echo -e " \n Have download filerun from 10FTP to /test/ryan "
exit 0
########################end
Reply With Quote
  #2 (permalink)  
Old 23-02-2005, 11:41 AM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
OS: Debian GNU/Linux
Posts: 506
Thanks: 0
Thanked 8 Times in 6 Posts
Rep Power: 7
monk has a spectacular aura about monk has a spectacular aura about
Default

Replace ! with EOS (END OF SCRIPT OR FTP). That should help i guess

###########################################Start
#!/bin/bash

filename=$1

ftp -nv <<EOS
open 10.10.10.10
user anonymous 111@111.com
ascii
get $filename
close
bye
EOS

#why following cannot be execute?
clear
echo -e " \n Have download filerun from 10FTP to /test/ryan "
exit 0
########################end
Reply With Quote
  #3 (permalink)  
Old 23-02-2005, 12:02 PM
Administrator
User
 
Join Date: Jan 1970
Posts: 43
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 10
vivek has disabled reputation
Default

I think script should be as follows:

Code:
HOST="my.dot.com"
FTPU="anonymous"
FTPP="me@my.dot.com"
filename=$1 

ftp -n $HOST <<!
quote USER $FTPU
quote PASS $FTPP
ls
pwd
lcd
get $filename
quit
!

clear 
echo -e " \n Have download filerun from 10FTP to /test/ryan " 
exit 0
This is what we run on our own RHEL based pro FTPD server
Reply With Quote
  #4 (permalink)  
Old 23-02-2005, 12:05 PM
Junior Member
User
 
Join Date: Feb 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
ryan
Send a message via MSN to ryan
Default replace ! to EOF is ok. under linux

EOS is not OK.
Reply With Quote
  #5 (permalink)  
Old 23-02-2005, 12:08 PM
Junior Member
User
 
Join Date: Feb 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
ryan
Send a message via MSN to ryan
Default

replace ! to EOF is ok. under linux
Reply With Quote
  #6 (permalink)  
Old 23-02-2005, 12:18 PM
Administrator
User
 
Join Date: Jan 1970
Posts: 43
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 10
vivek has disabled reputation
Default

Did you run my above modified script?
Reply With Quote
  #7 (permalink)  
Old 09-03-2005, 10:10 PM
tatin
Guest
 
Posts: n/a
Default Script con éxito

Quote:
Originally Posted by vivek
Did you run my above modified script?
Hola !!!

Yo también tenÃÂ*a ese mismo problema, y probé lo que le sugirieron a ryan, pero no funcionó, al final probé el EOF y esto si funcionó.

Gracias,
Tatin
Reply With Quote
  #8 (permalink)  
Old 16-03-2005, 06:50 PM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
OS: Debian GNU/Linux
Posts: 506
Thanks: 0
Thanked 8 Times in 6 Posts
Rep Power: 7
monk has a spectacular aura about monk has a spectacular aura about
Default Re: Script con éxito

Quote:
Originally Posted by tatin
Quote:
Originally Posted by vivek
Did you run my above modified script?
Hola !!!

Yo también tenÃÂ*a ese mismo problema, y probé lo que le sugirieron a ryan, pero no funcionó, al final probé el EOF y esto si funcionó.

Gracias,
Tatin
I hope they don't understand the Spanish yet i run the script and works don't know why it is not working with you
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

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


Similar Threads

Thread Thread Starter Forum Replies Last Post
If file modified execute a script karabaja Shell scripting 3 23-11-2006 02:39 AM


All times are GMT +5.5. The time now is 03:06 AM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38