繁体   English   中英

Shell 脚本 - SSH 使用屏幕

[英]Shell Script - SSH using Screen

I am trying to develop a shell script / bash script with ssh and screen, using Ubuntu / Linux. 你能帮我纠正这里的问题吗?

#!/bin/bash
ssh -i keypair.pem -t ubuntu@ec2-address "screen -S teste"; cd 'home'; cd 'Shell'; ./'AWS - teste.sh' "

它不起作用。

您成为 shell 引用的受害者 - 这在使用 ssh 时很棘手。 你的命令做了类似的事情

cd home/Shell; ./AWS - teste.sh

所以我会尝试

ssh -i keypair.pem -t ubuntu@ec2-address screen -S teste "sh -c \"cd home/Shell; ./AWS - teste.sh\""

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM