当前位置: 代码迷 >> Solaris >> 请问:rsh命令在远端执行的返回结果怎么写入到本地文件
  详细解决方案

请问:rsh命令在远端执行的返回结果怎么写入到本地文件

热度:8467   发布时间:2013-02-26 00:00:00.0
请教:rsh命令在远端执行的返回结果如何写入到本地文件?
例如
rsh remoteserver echo /etc/hosts >> /var/test.log

这样写入的是远端的test.log还是本地的test.log
如果是远端的,如何写入本地?

谢谢

------解决方案--------------------------------------------------------
rsh remoteserver echo /etc/hosts >> /var/test.log
写入本地

rsh remoteserver "echo /etc/hosts >> /var/test.log"
写入远端
------解决方案--------------------------------------------------------
我刚刚man了一把rsh,下面的描述很有意思:

$man rsh
....
     The following command appends the file  lizard.file  on  the
     machine  called  lizard  to the file lizard.file2 which also
     resides on the machine called lizard:

       example% rsh lizard cat lizard.file ">>" lizard.file2
....


------解决方案--------------------------------------------------------
SSH(1)                                         BSD General Commands Manual                                         SSH(1)

NAME
     ssh - OpenSSH SSH client (remote login program)

SYNOPSIS
     ssh [-1246AaCfgKkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec] [-D  [bind_address:]port] [-e escape_char]
         [-F configfile] [-i identity_file] [-L  [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
         [-O ctl_cmd] [-o option] [-p port] [-R  [bind_address:]port:host:hostport] [-S ctl_path]
         [-w local_tun[:remote_tun]] [user@]hostname [command]

DESCRIPTION
     ssh (SSH client) is a program for logging into a remote machine and for executing commands on a remote machine.  It
     is intended to replace rlogin and rsh, and provide secure encrypted communications between two untrusted hosts over
     an insecure network.  X11 connections and arbitrary TCP ports can also be forwarded over the secure channel.

     ssh connects and logs into the specified hostname (with optional user name).  The user must prove his/her identity
     to the remote machine using one of several methods depending on the protocol version used (see below).

     If command is specified, it is executed on the remote host instead of a login shell.
  相关解决方案