HP NonStop G-Series User Manual

Page 154

Advertising
background image

If ftp finds a $HOME/.netrc autologin entry for the specified host, ftp attempts to use the
information in that entry to automatically log in to the remote host. The ftp command also loads
any command macros defined in the entry. In some cases (for example, when the required password
is not listed in an autologin entry), ftp prompts for the password before displaying the ftp>
prompt. Once ftp completes the autologin process, ftp executes the init macro if the macro
is defined in the autologin entry. If the init macro does not exist or does not contain a quit or
bye

command, ftp then displays the prompt and waits for a subcommand.

The remote user name that you specify either at the prompt or in a $HOME/.netrc file must exist
and must have a password defined at the remote host, or ftp fails.

The ftp command interpreter, which handles all commands entered at the ftp> prompt, provides
facilities that are not available with most file-transfer programs, such as the handling of filename
arguments to ftp commands, the ability to collect a group of commands into a single command
macro, and the ability to load macros from a $HOME/.netrc file. These facilities are designed
to allow simplifying repeated tasks and to allow using ftp in unattended mode.

The command interpreter handles filename arguments according to the following rules:

If a - (hyphen) is specified for the argument, the standard input file is used for read operations
and the standard output file is used for write operations.

If the first character of the filename is | (vertical bar), the remainder of the argument is
interpreted as a shell command. ftp then forks to a shell, using popen() with the argument
supplied, and reads (writes) from stdout (stdin). If the shell command includes spaces,
the argument must be quoted: for example, "| ls -lt". A particularly useful example of
this mechanism is

dir | more

Failing the preceding checks, if globbing is enabled, local filenames are expanded (see the
glob(3)

reference page either online or in the Open System Services Shell and Utilities

Reference Manual). If the ftp command expects a single local file (for example, put), only
the first filename generated by the globbing operation is used.

For get and mget subcommands with unspecified local filenames, the local filename is the
same as the remote filename, which can be altered by a case, ntrans, or nmap setting.
The resulting filename can then be altered if runique is on.

For mput commands and put commands with unspecified remote filenames, the remote
filename is the same as the local filename, which can be altered by a ntrans or nmap setting.
The resulting filename can then be altered by the remote server if sunique is on.

Note that the ftp command interpreter does not support pipes.

To end an ftp session when you are running interactively, use the bye or quit subcommand or
the end-of-file key sequence at the ftp> prompt. To end a file transfer before it has been completed,
use the interrupt key sequence. The default interrupt key sequence is Ctrl-c.

The stty command can be used to redefine this key sequence. Sending transfers (those from the
local host to the remote host) are normally halted immediately. Receiving transfers are halted by
sending an FTP ABOR instruction to the remote FTP server and discarding all incoming file transfer
packets until the remote server stops sending them.

If the remote server does not support the FTP ABOR instruction, the ftp> prompt will not appear
until the remote server has sent all the requested files. Additionally, if the remote server does
something unexpected, the local ftp process may need to be ended manually.

NOTE:

Secure SFTP transfer is available as a part of the SSH2 solution and provided with HP

NonStop SSH.

154 Transferring and Archiving Files

Advertising
This manual is related to the following products: