HP-UX Reference (11i v1 00/12) - 1 User Commands N-Z (vol 2)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man1/neqn.1
________________________________________________________________
___ ___
r
remsh(1) Kerberos remsh(1)
If a command and the option -n are specified, then standard input is redirected to remsh by
/dev/null.If-n is not specified (the default case), remsh reads its standard input and sends the input
to the remote command. This is because remsh has no way to determine whether the remote command
requires input. This option is useful when running a shell script containing a remsh command, since oth-
erwise remsh may use input not intended for it. The -n option is also useful when running remsh in the
background from a job control shell, /usr/bin/csh or /usr/bin/ksh. Otherwise, remsh stops and
waits for input from the terminal keyboard for the remote command. /usr/bin/sh automatically
redirects its input from /dev/null when jobs are run in the background.
Host names for remote hosts can also be commands (linked to remsh) in the directory /usr/hosts.If
this directory is specified in the $PATH environment variable, you can omit remsh. For example, if
remotehost is the name of a remote host, /usr/hosts/remotehost is linked to remsh, and if
/usr/hosts is in your search path, the command
remotehost command
executes command on remotehost , and the command
remotehost
is equivalent to
rlogin remotehost
The rexec command works the same as remsh except that it uses the rexec() library routine and
rexecd for command execution (see rexec(3N) and rexecd(1M)) and does not support Kerberos authentica-
tion. rexec prompts for a password before executing the command instead of using hosts.equiv for
authentication. It should be used in instances where a password to a remote account is known but there
are insufficient permissions for
remsh.
EXAMPLES
Shell metacharacters that are not quoted are interpreted on the local host; quoted metacharacters are
interpreted on the remote host. Thus the command line:
remsh otherhost cat remotefile >> localfile
appends the remote file remotefile to the local file localfile, while the command line
remsh otherhost cat remotefile ">>" otherremotefile
appends remotefile to the remote file otherremotefile
.
If the remote shell is
/usr/bin/sh , the following command line sets up the environment for the remote
command before executing the remote command:
remsh otherhost . .profile 2>&- \; command
The 2>&- throws away error messages generated by executing .profile when stdin and stdout are not
aterminal.
The following command line runs
remsh in the background on the local system, and the output of the
remote command comes to your terminal asynchronously:
remsh otherhost -n command &
The background remsh completes when the remote command does.
The following command line causes remsh to return immediately without waiting for the remote command
to complete:
remsh otherhost -n "command 1>&- 2>&- &"
(See remshd(1M) and sh(1)). If your login shell on the remote system is csh, use the following form
instead:
remsh otherhost -n "sh -c \"command 1>&- 2>&- &\""
RETURN VALUE
If remsh fails to set up the secondary socket connection, it returns 2. If it fails in some other way, it
returns 1. If it fully succeeds in setting up a connection with remshd, it returns 0 once the remote com-
mand has completed. Note that the return value of remsh bears no relation to the return value of the
remote command.
Section 1782 2 HP-UX Release 11i: December 2000
___
___