I have a short simple script, that compiles a .c
file and runs it on a remote server running tcsh
and then just gives back control to my machine (this is for school, I need my programs to work properly on the lab computers but want to edit them etc. on my machine). It runs commands this way:
我有一个简短的简单脚本,它编译一个.c文件并在运行tcsh的远程服务器上运行它然后只是给我的机器控制(这是为了学校,我需要我的程序在实验室计算机上正常工作但是想要在我的机器上编辑它们等。它以这种方式运行命令:
ssh -T user@server << EOF
cd cs4400/$dest
gcc -o $efile $file
./$efile
EOF
So far it works fine, but it gives this warning every time I do this:
到目前为止它工作正常,但每次我这样做时都会发出警告:
Warning: no access to tty (Bad file descriptor).
Thus no job control in this shell.
I know this technically isn't a problem, but it's SUPER annoying. I'm trying to do school work, checking the output of my program etc., and this clutters everything, and I HATE it.
我知道这在技术上不是问题,但它太烦人了。我正在尝试做学校的工作,检查我的程序的输出等,这会弄乱一切,我讨厌它。
I'm running this version of ssh on my machine:
我在我的机器上运行这个版本的ssh:
OpenSSH_6.1p1 Debian-4, OpenSSL 1.0.1c 10 May 2012
This version of tcsh on the server:
服务器上的这个版本的tcsh:
tcsh 6.17.00 (Astron) 2009-07-10 (x86_64-unknown-linux)
And this version of ssh on the server:
这个版本的ssh在服务器上:
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
1 个解决方案
#1
1
On OS X, I solved a similar problem (for script provisioning on Vagrant) with ssh -t -t
(note that -t
comes twice). Advice based on the ssh BSD man page:
在OS X上,我用ssh -t -t解决了类似的问题(对于Vagrant上的脚本配置)(注意-t来了两次)。基于ssh BSD手册页的建议:
-T Disable pseudo-terminal allocation.
-T禁用伪终端分配。
-t Force pseudo-terminal allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g. when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.
-t强制伪终端分配。这可用于在远程机器上执行任意基于屏幕的程序,这可能非常有用,例如,实现菜单服务时。多个-t选项强制tty分配,即使ssh没有本地tty。
#1
1
On OS X, I solved a similar problem (for script provisioning on Vagrant) with ssh -t -t
(note that -t
comes twice). Advice based on the ssh BSD man page:
在OS X上,我用ssh -t -t解决了类似的问题(对于Vagrant上的脚本配置)(注意-t来了两次)。基于ssh BSD手册页的建议:
-T Disable pseudo-terminal allocation.
-T禁用伪终端分配。
-t Force pseudo-terminal allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g. when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.
-t强制伪终端分配。这可用于在远程机器上执行任意基于屏幕的程序,这可能非常有用,例如,实现菜单服务时。多个-t选项强制tty分配,即使ssh没有本地tty。