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
Calling expect scripts from other expect scripts seva Shell Programming and Scripting 0 04-03-2008 10:45 AM
scripts please rrdore SUN Solaris 2 12-07-2006 02:35 AM
use of ssh in scripts esham Shell Programming and Scripting 7 11-16-2005 08:27 AM
Help with GDL to SQL scripts ch4r1e5 Shell Programming and Scripting 0 10-31-2005 02:51 PM
using su in scripts uchachra UNIX for Dummies Questions & Answers 3 03-11-2002 10:24 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #15  
Old 11-30-2007
Registered User
 

Join Date: Sep 2007
Posts: 87
Quote:
Originally Posted by vgersh99 View Post
you can close your eyes.....
Code:
#!/bin/ksh

oldmodes=$(stty -g)
stty -echo
read password
stty ${oldmodes}
It worked fine ..

But is there a way to read from a file about the directories

for an example , the directories are not going to be constant and i am trying to get a file from a server by reading the param file a.txt

and placing it in a directory in the target which should also be read from a file

i am struggling a bit here

can anyone help me on this

Thanks
Reply With Quote
Forum Sponsor
  #16  
Old 11-30-2007
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
here's an idea to expand upon - it probably does not answer your specific question, but should make you think how to adopt it to what you need.

Quote:
# I need to read a set of filenames from another file ('listOfFiles')
# and ftp 'get' them from a remote system. What is the way to get
# it by using ftp command once and send them all in a loop
# instead of using ftp command in the loop?
# Assumption: the 'listOfFiles' file containts a list of files to be
# ftp-ed - one file name per line.
Code:
#!/bin/ksh

ftp -nv <<EOF
open $FTP_SRVR
user $FTP_USR
pass $FTP_PWD
ascii
cd $ifile
lcd "$ofile"
$(sed -e 's/^/get /g' ${listOfFiles})
bye
EOF

Last edited by vgersh99; 11-30-2007 at 01:27 PM.
Reply With Quote
  #17  
Old 11-30-2007
Registered User
 

Join Date: Sep 2007
Posts: 87
Quote:
Originally Posted by vgersh99 View Post
here's an idea to expand upon - it probably does not answer your specific question, but should make you think how to adopt it to what you need.


Code:
#!/bin/ksh

ftp -nv <<EOF
open $FTP_SRVR
user $FTP_USR
pass $FTP_PWD
ascii
cd $ifile
lcd "$ofile"
$(sed -e 's/^/get /g' ${listOfFiles})
bye
EOF
not sure of this function , so you mean to say that , the list of files i need ti define it in a variable , ?

before the ftp session starts
Reply With Quote
  #18  
Old 11-30-2007
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
yes. the value of variable 'listOfFiles' is the pathname to the file containing the 'file names' that you need to operate on (one per line).
Reply With Quote
  #19  
Old 11-30-2007
Registered User
 

Join Date: Sep 2007
Posts: 87
Just Checking whether will it work , if i give the directory there in list of files
mean to say only the directory name and getting all the files in the directory
to the remote server?

Thanks
Reply With Quote
  #20  
Old 11-30-2007
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
Quote:
Originally Posted by raghav1982 View Post
Just Checking whether will it work , if i give the directory there in list of files
mean to say only the directory name and getting all the files in the directory
to the remote server?

Thanks
well.... your initial explanation was not clear and I had to throw just an idea.
what exactly do you want to specify?
  1. a list of files to be transfered?
  2. a list of directories - and get/put ALL the files from 'listed' directories?
  3. maybe a combination of the above????
What I've posted covers '1.'
Reply With Quote
  #21  
Old 11-30-2007
Registered User
 

Join Date: Sep 2007
Posts: 87
Smile

combination of 1 & 3

I am asking the User to enter the Source Server

he enters the source userid& Password

Loggin to the source server and getting some files

This is my basic scenario

but i have a requirement that my filename and directory paths are not Static , so i need to define the directory to login to the source server and need to define the filenames and also need to define where i need to place the file (get) to the target server

Please let me know if this is a bit confusing

Thanks
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 07:32 AM.


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