获取stty:标准输入:当通过ssh隧道使用scp时,设备的ioctl不合适

jon*_*rry 28 linux ssh scp

根据标题,当我尝试scp通过ssh隧道时,我收到以下警告.在我的情况下,我不能scp直接foo因为设备foo上的端口1234正被转发到专用网络上的另一个机器栏(并且bar是给我隧道到192.168.1.23的机器).

$ # -f and -N don't matter and are only to run this example in one terminal
$ ssh -f -N -p 1234 userA@foo -L3333:192.168.1.23:22
$ scp -P 3333 foo.py ubuntu@localhost:
ubuntu@localhost's password:
stty: standard input: Inappropriate ioctl for device
foo.py                                          100% 1829     1.8KB/s   00:00
Run Code Online (Sandbox Code Playgroud)

有谁知道为什么我会收到这个警告Inappropriate ioctl for device

mMo*_*ntu 59

当我在我的网上包含以下内容时,我遇到了完全相同的问题~/bashrc:

stty -ixon
Run Code Online (Sandbox Code Playgroud)

这一行的目的是允许在反向搜索bash时使用Ctrl-s.

此链接有解决方案(不可用)

Web Archive版本的上述链接

'stty'适用于ttys,您可以使用它进行交互式登录会话..kshrc是针对所有会话执行的,包括stdin不是tty的会话.除了将其移动到.profile之外,解决方案是使执行成为一个交互式shell.

有几种方法可以检查令人讨厌的shell.以下解决了bash的问题:

[[ $- == *i* ]] && stty -ixon
Run Code Online (Sandbox Code Playgroud)

  • 在这里找到"[[$ - =*i*]]"的解释(我当然需要它):http://stackoverflow.com/questions/31155381/what-does-i-mean-in-bash/31155446 (4认同)