我是 linux/unix 世界的新手。我想在远程机器上触发 make。为此,我在远程机器上创建了一个小脚本,我想通过 ssh 执行它。
脚本看起来像这样:
echo "loading .profile"
. ~/.profile
echo "profile loaded"
echo "starting gmake"
cd ~/helloWorld/
gmake all
我使用以下 ssh 命令调用脚本:
ssh user@remotehost "cd ~/helloWorld && ./myscript.sh"
当我执行这个命令时,我的机器连接到远程机器。它告诉我配置文件已加载,然后我必须按 [CTRL]+[D] 才能继续执行脚本。所以看起来 。 ./myscript.sh
命令创建类似新终端的东西。我不想要这种行为。我想使用 ssh 命令来自动化构建过程,而不需要手动关闭终端。有办法做到这一点吗?
谢谢你的期待, 约翰
最佳答案
.
/source
不会调用新的 shell。它在当前 shell 中运行脚本中的命令。其他地方出了问题。
关于linux - 通过 ssh 执行命令时从 .profile 获取环境,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2550862/