nixCraft Linux Forum

nixCraft

Linux 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

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 02-23-2005, 07:26 AM
Junior Member
User
 
Join Date: Feb 2005
Posts: 8
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
Sponsored Links
  #2 (permalink)  
Old 02-23-2005, 12:41 PM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
My distro: Debian GNU/Linux
Posts: 482
Rep Power: 5
monk will become famous soon enough monk will become famous soon enough
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 02-23-2005, 01:02 PM
Administrator
Site Admin
 
Join Date: Jan 1970
Posts: 43
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 02-23-2005, 01:05 PM
Junior Member
User
 
Join Date: Feb 2005
Posts: 8
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 02-23-2005, 01:08 PM
Junior Member
User
 
Join Date: Feb 2005
Posts: 8
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 02-23-2005, 01:18 PM
Administrator
Site Admin
 
Join Date: Jan 1970
Posts: 43
Rep Power: 10
vivek has disabled reputation
Default

Did you run my above modified script?
Reply With Quote
  #7 (permalink)  
Old 03-09-2005, 11: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 03-16-2005, 07:50 PM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
My distro: Debian GNU/Linux
Posts: 482
Rep Power: 5
monk will become famous soon enough monk will become famous soon enough
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

Bookmarks


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 On

Similar Threads

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


All times are GMT +5.5. The time now is 07:51 PM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

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