ftp program is handy for transferring files but it only works if the remote host is directly reachable via TCP. Suppose you have to
telnet to a modem pool and then dial out to another modem to reach the remote host. Not only can
ftp not handle this but neither can a lot of other communications programs. In Chapter 16 (p. 346), I presented a file transfer script that used
sz. Like many other communications programs,
sz require binary copies of their counterpart at each end of the link. If you do not have both, copying one to the other end can be a problem—if it was easy, you would not need the programs in the first place! Even worse, many versions of
telnet and other programs do not provide 8-bit clean connections. So even if you had
sz, you might not be able to use them over a
The script below works over many kinds of links and does not require a copy of itself on the other end. The only assumptions made are that the usual UNIX utilities (such as
compress) exist and that the line is error free. If you do not have
compress, that can be removed from the script as well. It is used only to speed the transfers.
The script is quite a bit fancier than the
sz script. This one interactively prompts for file names and other commands.
The script starts off by finding out what the prompt looks like. It then disables the default timeout. The script has a verbose mode so that the user can see what is happening internally. ...