在Mac(iMac OSX)终端中远程运行脚本(r脚本)到其他计算机 [英] running script (r script) remotely to other computer in mac (iMac OSX ) terminal
问题描述
我有一个小的示例脚本(script_p.r
),如下所示,该脚本打算在终端中运行.
I have small example script (script_p.r
) like the following, which in intend run in terminal.
#!/usr/bin/Rscript
sink("output_capture.txt")
mn <- mean(1:10)
# and so on, much longer list of tasks
我想与其他iMac主机(IP地址例如不是真实的111.111.111.111
)远程运行此脚本,这使我可以登录并工作(例如,不是真实的.用户名user101
,密码p12334
)
I want to run this script remotely with other iMac host computer (ip address e.g.. not real : 111.111.111.111
) which allows me to log in and work (e.g., not real. username user101
, password p12334
)
是以这种方式远程运行此脚本(例如使用ssh
),例如从其他IP地址为222.222.222.222
且用户名为user102
的计算机上运行该脚本吗?
Is this way to run this script remotely (say using ssh
), say from other computer with ip address: 222.222.222.222
and user name user102
?
推荐答案
首先,将script_p.r
放在远程计算机上.
First, put script_p.r
on the remote machine.
然后要么做:
ssh user102@222.222.222.222
user102:-$ ./script_p.r
或ssh user102@222.222.222.222 'script_p.r'
或将其放在脚本中:
runremote.sh
:
or put it in a script:
runremote.sh
:
#!/bin/bash
ssh user102@222.222.222.222 'script_p.r'
并在本地运行
user101:-$ ./runremote.sh
这篇关于在Mac(iMac OSX)终端中远程运行脚本(r脚本)到其他计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!