![](/img/trans.png)
[英]How do I get a sound to fire on local machine when I run a bash script on a remote computer via SSH?
[英]How can I run a shell script via SSH such that the environment of the remote computer is similar to that of the local computer?
我欢迎改写我的问题,因为我不确定问题到底是什么。
我正在尝试使用以下格式的命令通过SSH运行Shell脚本:
ssh -o StrictHostKeyChecking=no lxplus0035 "cd ~/test; bash script1.sh"
当我这样做时,复杂的脚本script1.sh
会因许多语法错误,操作数错误和其他错误而中断。 示例如下:
stty: standard input: Invalid argument
当在本地系统和远程系统中(而不是通过SSH会话连接)直接而不是通过SSH运行时,该脚本可以正常工作。 为什么通过SSH执行脚本会导致这些问题?
stty
问题与您的环境无关,这是SSH命令未为您分配TTY的结果( 什么是Pseudo TTY-Allocation?(SSH和Github) )。 为ssh
添加-t
参数可以解决该问题。
更多信息:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.