#!/usr//bin/kermit +
    if not defined \%1 exit 1 usage filename [port] [speed] [module] [download-directory] [filepath] [filename]
    if not defined \%2 exit 1 usage filename [port] [speed] [module] [download-directory] [filepath] [filename]
    if not defined \%3 exit 1 usage filename [port] [speed] [module] [download-directory] [filepath] [filename]
    if not defined \%4 exit 1 usage filename [port] [speed] [module] [download-directory] [filepath] [filename]
    if not defined \%5 exit 1 usage filename [port] [speed] [module] [download-directory] [filepath] [filename]
    if not defined \%6 exit 1 usage filename [port] [speed] [module] [download-directory] [filepath] [filename]
    SET modem type none
    SET line \%1
    IF fail end 1 OPEN PORT FAILED
    SET serial 8N1
    SET speed \%2
    SET file download-directory \%4
    SET protocol kermit -ir
    SET CARRIER-WATCH OFF
    set quiet on
    set command interrupt off
    set receive timeout 10
    #LOG debugging debug.log
    #cd yyy
    #receive \%4 /binary
    #if success connect
    #set input echo off
    echo START
    OUTPUT \13
    INPUT 5 #:
    if success {
	OUTPUT \04
	SLEEP 10
    }
    OUTPUT end\59
    SLEEP 20
    OUTPUT \36
    INPUT 10 \fpattern(*Passwd<)
    IF fail exit 1 LOGIN FAILED
    OUTPUT POISON\59
    INPUT 5 \fpattern(*N.exchange<)
    IF fail exit 1 PASS FAILED
    OUTPUT \%3\59
    INPUT 20 \fpattern(*<)
    IF fail exit 1 MODULE FAILED
    OUTPUT shell::\59
    INPUT 20 \fpattern(*#)
    IF fail exit 1 SHELL FAILED
    echo LOGIN TO SHELL IS OK
    LINEOUT cd \%5
    LINEOUT kermit -is \%6
    RECEIVE /binary
    if fail {
	close
	exit 1 TRANSFER FAILED
    }
    if success
    {
	close
	exit 0 COMPLETE
    }
