#!/bin/ksh . $HOME/bin/init.ksh log_start exit_if_not_dgftp EXPIRE_DAYS=30 create_arc_dir handle_error abort $? "Command create_arc_dir failed" $USER purge_archive $EXPIRE_DAYS WORK_FILE=RetriesExceeded.csv USER= HOST=lawsonfax.test.org # Ftp the file # Ftp username and password is in .netrc $FTP -v $HOST lcd $WORK_FILE get RetriesExceeded.csv quit archive_file $WORK_FILE # /law/bin/mpack -s "Fax Retries Exceeded" $WORK_FILE_OUTPUT $USER log_stop exit 0 

ERROR: Not recognizing the 'get' portion of the script and down. It is working throught he connection.

[dgftp@lawapp2]/lawif/bin$ get_lawson_fax.ksh Connected to lawsonfax.test.org. 220 Microsoft FTP Service 331 Password required for dgftp. 230 User logged in. ftp> quit 221 Goodbye. /lawif/bin/get_lawson_fax.ksh[33]: lcd: not found /lawif/bin/get_lawson_fax.ksh[34]: get: not found /lawif/bin/get_lawson_fax.ksh[35]: quit: not found [dgftp@lawapp2]/lawif/bin$ 

The file I'm getting is on a windows server.

2

1 Answer

You should be able to use a here document to pass commands to the ftp session's standard input:

$FTP -v "$HOST" << EOF lcd "$WORK_FILE" get RetriesExceeded.csv quit EOF 

The EOF string can be replaced by any arbitrary word to denote the start and end of input.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy