The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages here.

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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-09-2006
aungomarin aungomarin is offline
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 03:11 AM..
  #2 (permalink)  
Old 05-09-2006
bugbugbug bugbugbug is offline
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
  #3 (permalink)  
Old 05-09-2006
thestevew thestevew is offline
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
  #4 (permalink)  
Old 05-09-2006
JrLz JrLz is offline
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.....
  #5 (permalink)  
Old 05-10-2006
aungomarin aungomarin is offline
Registered User
  
 

Join Date: Apr 2006
Location: Thailand
Posts: 15
Thks all very much for answer
  #6 (permalink)  
Old 11-16-2007
sfaqih sfaqih is offline
Registered User
  
 

Join Date: Oct 2007
Location: Yemen
Posts: 19
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 .
  #7 (permalink)  
Old 11-20-2007
Cameron's Avatar
Cameron Cameron is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2001
Location: Brisbane, Australia
Posts: 499
Quote:
Originally Posted by thestevew View Post
Code:
read uid?"UserId: "
read pwd?"Password: "
Hi thestevew,
Noticed your read statements.
What's with the `?` at the end of the variable - never seen it used before (nor find reference in a 'man read').

Cheers,
Cameron
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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




All times are GMT -4. The time now is 06:06 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0