Computing.Net > Forums > Unix > can an FTP Korn Shell Script be written

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

can an FTP Korn Shell Script be written

Reply to Message Icon

Name: Harry
Date: July 30, 2002 at 07:43:46 Pacific
Comment:

hello,
I am having trouble creating a batch script
to FTP a file from UNIX to NT. It seems that when I invoke the script, the ftp command invokes the interactive ftp interpreter and does not return control to my script.
And there is no way that i have found to pass
parameters to the ftp process to put the files...
On Windows NT there is the -s parameter which specifies a file to use to obtain the ftp commands;however, that option seems to be missing on the UNIX side.

does anyone have any suggestions and possibly a sample korn shell script to ftp
a file without invoking interactive mode?

I would think that this would be a common
process so that ftp can be automated via scheduled scripts.

thank you to any and all that may be able to help me; I am new to UNIX and can use all the help I can get! thanks very much (:



Sponsored Link
Ads by Google

Response Number 1
Name: deejay
Date: July 30, 2002 at 14:48:11 Pacific
Reply:

I cheated by scheduling a WS_FTP task
on my PC to "pull" from UNIX, rather
than using a UNIX shell script to "push"
to my PC.

Here is the DOS batch file which I scheduled:

c:\ws_ftp\ftp95pro -p f10a -ascii plessf10.plano.esc.eds.com:/export/home/hzwbh7/stats/xmin.txt local:\dcjunix\auto.ftp\djprfst.csv
cd c:\dcjunix\auto.ftp
copy /A prev.csv+djprfst.csv next /A
erase /f /q prev.csv
ren next prev.csv
erase /f /q xferlog.txt


0

Response Number 2
Name: David Perry
Date: July 31, 2002 at 04:30:21 Pacific
Reply:

This is dependent on the ftp client on your unix platform but the following should work on most:

#!/bin/sh
ftp -n -i remotehost <user username password
get filename
close
quit
!!



0

Response Number 3
Name: niru
Date: August 5, 2002 at 05:57:51 Pacific
Reply:

hi ,
here i have given the simple script to noninteractive script for ftp.
try this out..

#! /bin/ksh

TMP_CMDS=/tmp/niru/fcmd
TMP_OUTPUT=/tmp/niru/fout
echo "open machine ip" > $TMP_CMDS
echo "user username passwd" >> $TMP_CMDS
echo "cd niru" >> $TMP_CMDS #where the file resides
echo "lcd /tmp/niru" >> $TMP_CMDS # where u want the files to get ftped
echo "binary" >> $TMP_CMDS # mode ur selection
echo "get filename " >> $TMP_CMDS #u can use mget for multiple files

echo "quit" >> $TMP_CMDS
ftp -vin > $TMP_OUTPUT
if [ $? -eq 0 ]
then
rm -f $TMP_OUTPUT
rm -f $TMP_CMDS
fi

Thanks,
niru..


0

Response Number 4
Name: Sam
Date: August 23, 2002 at 13:52:23 Pacific
Reply:

Hi,

Additional question to this..

Is it possible to pass a shell variable to the ftp script..I am trying to get the filename dynamically associated with the ftp script. The filename could be passed as a shell variable..

Thanks
Sam


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: can an FTP Korn Shell Script be written

sftp Korn shell script www.computing.net/answers/unix/sftp-korn-shell-script/4741.html

korn shell script problem (using awk ? ) www.computing.net/answers/unix/korn-shell-script-problem-using-awk-/3547.html

Korn Shell script for julian date? www.computing.net/answers/unix/korn-shell-script-for-julian-date/3729.html