1

我正在尝试将 Bash 脚本中的变量设置为通过带有超时选项的 rsh 在远程计算机上运行命令的结果,例如...

timeout -s KILL 2 rsh jane df -h | grep StorageMedia
                  2.7T  2.1T  607G  78% /mnt/StorageMedia

我尝试了以下...

rshresult="$(timeout -s KILL 3 rsh remotemachine df -h | grep StorageMedia)"

and

rshresult=`timeout -s KILL 3 rsh remotemachine df -h | grep StorageMedia`

...但是在没有设置 $rshresult 的情况下都在 3 秒后超时。

跑步

4

0 回答 0