The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
To call/execute a shell script from a shell script konark UNIX for Dummies Questions & Answers 1 10-26-2007 02:16 PM
How to pass a parameter from one Shell-script to another Shell-script subodhbansal Shell Programming and Scripting 2 09-22-2007 02:19 AM
How to Run a shell script from Perl script in Parent shell? hifake Shell Programming and Scripting 16 08-28-2007 05:42 PM
Accessing variables of one shell script in another shell script rsendhilmani Shell Programming and Scripting 1 04-30-2007 05:43 AM
Have a shell script call another shell script and exit heprox Shell Programming and Scripting 2 11-20-2006 05:17 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-08-2006
Registered User
 

Join Date: Apr 2006
Location: Thailand
Posts: 15
ftp with shell script

Can I ftp to put file with shell script(as bath file) ?
Plz give the simple code to do that.

My script look like that

#!/bin/sh
echo "Start ftp"
ftp temphost <<EOF
put file
quit
EOF
# end

This code ignore username & password but I need to input.
How to input username & password to this code ? Thk

Last edited by aungomarin; 05-09-2006 at 12:11 AM.
Reply With Quote
Forum Sponsor
  #2  
Old 05-09-2006
Registered User
 

Join Date: Jan 2005
Posts: 6
edit .netrc file at your home directory ,add code like this:
machine 192.168.0.1 login myusr password 123
save it,then chmod 600 .netrc
ps:192.168.0.1 is destination address
myusr is your login name
123 is your password
Reply With Quote
  #3  
Old 05-09-2006
Registered User
 

Join Date: Mar 2006
Location: South Yorkshire, UK
Posts: 114
or get userid/password before starting ftp (not for insecure environments as password is visible):
Code:
 
#!/bin/sh
read uid?"UserId: "
read pwd?"Password: "
echo "Start ftp"
ftp -n temphost <<EOF
user $uid $pwd
put file
quit
EOF
# end
Reply With Quote
  #4  
Old 05-09-2006
Registered User
 

Join Date: May 2006
Posts: 1
would you mind using expect/autoexpect command?
it's a shell script isn't it?
it's really useful for interactive programs....
worth a try.....
Reply With Quote
  #5  
Old 05-09-2006
Registered User
 

Join Date: Apr 2006
Location: Thailand
Posts: 15
Thks all very much for answer
Reply With Quote
  #6  
Old 11-16-2007
Registered User
 

Join Date: Oct 2007
Location: Yemen
Posts: 18
Dear Friends,

Please Let me know which .netrc file should I edit either in my home directory of in the destination home directory.
I need to know the idea of .netrc file. I really misunderstand it.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Actually what I'm doing is the following:
1. I have 192.168.30.151 unix server
2. I have 123.123.130.200 unix destination server.
3. I need to ftp auto. from server No. 1 to destination server.
How can I make this in detail. please .
Reply With Quote
  #7  
Old 11-16-2007
Registered User
 

Join Date: Oct 2007
Location: Yemen
Posts: 18
Sorry guys. I've understood what you have written. and I'm totally great full for your efforts and excellent ideas. thanx again and again.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:22 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0