From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,e7cc1aea52f175db X-Google-Attributes: gidfee84,public From: Avarham Shapiro Subject: another way Date: 1998/10/05 Message-ID: <56045E2FB5F0D1119E4F0000F863199D014B0B50@SY3026.AmMobile.com>#1/1 X-Deja-AN: 397957740 Sender: Avarham Shapiro References: <36107E7D.8589ADBA@rto.dec.com> Newsgroups: comp.unix.osf.osf1 If you don't know TCL or PERL and you're pressed for time you can do some relatively easy things: 1. Create a .netrc file. If you connect to multiple hosts include all of them in it. If the passwords or usernames change you must write it on the fly from your shell script before invoking ftp. Remember to have a protection of 400 (root read only) on the .netrc (this does NOT mean that ftp must run under root). The .netrc resides in home directory so there can be multiple instances. The beauty of .netrc is that it elimitates a need for an expect program. 2. Run the shell which invokes ftp with the host name. .netrc takes care of login, open. 3. either hardcode the ftp commands in the script or write them on the fly. This depends on whether you always get the same files 1. hardcode example (in ksh): FTP host-name << END verbose off debug on binary cd user mget application_foo.* quit -END if [[ $? -ne 0 ]] then #handle the error fi 2. Write on fly example #compute file list (possibly the remote directory) echo cd $user > /tmp/ftp.cmd echo verbose off >> /tmp/ftp.cmd echo debug on >> /tmp/ftp.cmd echo binary >> /tmp/ftp.cmd echo mget $files-set >> /tmp/ftp.cmd echo quit >>/tmp/ftp.cmd FTP host-name I am currently running a DUNIX 4.0b system. We have a requirement to do > some automated files transfers between ftp servers. I have written script > which uses some SQL to generate the file. I then need to ftp the file to a > remote site. I am having a problem with the syntax of my shell script. How > do you pass the relevant commands to ftp (open ftp.mycompany.com etc.) from > a shell script?