![]() |
Hello and Welcome from to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Call a perl script inside a shell script | chriss_58 | Shell Programming and Scripting | 3 | 12-01-2008 04:28 AM |
| invoking a shell script inside cgi shell script | smriti_shridhar | Shell Programming and Scripting | 2 | 07-09-2008 02:50 AM |
| How to run an SQL script inside a shell | stevefox | Shell Programming and Scripting | 1 | 06-15-2006 11:11 PM |
| How to run unix commands in a new shell inside a shell script? | hkapil | Shell Programming and Scripting | 2 | 01-04-2006 06:56 AM |
| Using tar inside a shell script | kas7225 | Shell Programming and Scripting | 2 | 05-20-2005 12:06 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Dears,
I'm new in shell scripting and i need your help, i would like to know how can i create a script to ftp to a certain unix/linux machine/server IP address and get a file for example without user intervention? How can i force the script to use a certain username and password to access this machine then execute the "change directory" to go to a certain path and get the requested file? I appreaciate your help Many thanks in advance |
|
||||
|
quote=Dendany83;302303901]Dears,
I'm new in shell scripting and i need your help, i would like to know how can i create a script to ftp to a certain unix/linux machine/server IP address and get a file for example without user intervention? How can i force the script to use a certain username and password to access this machine then execute the "change directory" to go to a certain path and get the requested file? I appreaciate your help Many thanks in advance[/quote] Your can shell as follows shellname ftpservername userid password localdir remotedir filename Code:
#!/bin/ksh
LANHOST=$1
USER=$2
PASSWD=$3
SRCDIR=$4
DATAIN=$5
FILENAME=$6
ftp -nv ${LANHOST} <<END
user ${USER} ${PASSWD}
cd ${SRCDIR}
lcd ${DATAIN}
get ${FILENAME}
bye
END
|
|
||||
|
Yes, you CAN do the scripting as suggested above. However, if anything goes wrong, those simplistic scripts will fail unpleasantly.
Nowadays I really recommend using simple Perl scripts for this kind of task. It's not at all hard - see Perl Net::FTP for an introduction. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|