Using Internet Services
32 Chapter5
Executing Commands with remsh
Using remsh
Using remsh
The remsh command has the following syntax:
remsh
remote_host
[-l
remote_login_name
]
command
[\;
command
...]
If you do not give any commands on the remsh command line, remsh
interprets any options in the command line as rlogin options and runs
rlogin.
Shell metacharacters (like <, |, or >>) are interpreted on the local host,
unless you enclose them in double quotes. For example, the following
command creates newfile on host basil; without the quotes, it would
create newfile on the local host:
remsh basil cat my_message ">" newfile
CAUTION Do not use remsh to run an interactive command, such as vi or more.
With some interactive commands, remsh hangs. To run interactive
commands, log into the remote host with rlogin.
The following example uses the find command to look for the file
status.july in the project directory on remote host basil:
remsh basil find /project -name status.july -print
In the following example, a user on the local system uses remsh to create
a file called hi_mike in user mike’s home directory on remote host sage:
remsh sage cd /home/sage/mike\;echo Hi, Mike! ">" hi_mike
In the following example, a user uses remsh to log into user paula’s home
directory on host basil and mail the meeting_minutes file to the
members of the proj_team mailing list:
remsh basil -l paula mailx proj_team "<" meeting_minutes