让一个程序通过ssh执行另一个程序

问题描述 投票:1回答:1

如标题中所述,我想让程序在ssh上执行程序。意味着我在Linux笔记本电脑上有一个程序,该程序将执行Raspberry Pi上的文件。类似于:

my_Program_local ./[email protected]:22/Path_to_ssh_file_on_Raspberry_Pi".

赞赏每一个提示。

linux ubuntu ssh raspberry-pi3 ssh-tunnel
1个回答
0
投票

您可以尝试:

my_Program_local <<< $(ssh [email protected] cat /Path_to_ssh_file_on_Raspberry_Pi)

例如,给出此脚本:

$ cat test.sh

#!/bin/bash

cat $1

您将运行:

$ ./test.sh <<< $(ssh myuser@mytestserver cat ~/test-file)
this is a remote test file

否则,您将必须导出一个NFS卷,使其指向Raspberry中远程文件的路径,并将其安装在笔记本电脑中,以便您可以直接访问它。

© www.soinside.com 2019 - 2024. All rights reserved.