简体   繁体   English

stty:标准输入:设备的 ioctl 不合适

[英]stty: standard input: Inappropriate ioctl for device

perl script.pl --f1="t1" --f2="t2" --f3="t4" --f4 < /home/joe/a.txt 

script.pl脚本文件

use Getopt::Long;
my ($f1, $f2, $f3, $f4) ;
GetOptions (
            'f1=s' => \$f1,
            'f2=s' => \$f2,
            'f3=s' => \$f3,
            'f4' => \$f4, );
if ($f1) {
    system('stty -echo');
    print "Password:";
    $pwd = <STDIN>;
    system('stty echo');
}

I got this error:我收到此错误:

stty: standard input: Inappropriate ioctl for device
Password:stty: standard input: Inappropriate ioctl for device

What is this error?这是什么错误? How do I resolve it?我该如何解决?

I think the problem is you are reading from a redirected STDIN (because you <file.txt)我认为问题在于您正在从重定向的 STDIN 中读取数据(因为您是 <file.txt)

$ perl -e 'system("stty -echo");' </tmp/foo
stty: standard input: Inappropriate ioctl for device

You should probably pass your file as a parameter to your script.您可能应该将您的文件作为参数传递给您的脚本。

This message is painful , for users and programmers.这个消息对于用户和程序员来说是痛苦的 It pollutes the STDOUT, sometimes 3 times in a row.它会污染 STDOUT,有时会连续 3 次。

There is no way to suppress it , even with messing with the stty -echo stuff.没有办法抑制它,即使弄乱了stty -echo东西。

The sole solution is to redirect all the errors to /dev/null唯一的解决方案是将所有错误重定向到/dev/null

./myscript <<< "some stuffs" 2> /dev/null
Or similary
echo "stuffs" | ./myscript 2> /dev/null

Annoying, and thus throw away all potential errors, which is not wanted at all .烦人,因此扔掉所有潜在的错误,这是根本不想要的

not wanted at all.

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

相关问题 如何抑制“stty:'标准输入':设备的 ioctl 不合适”错误 - How to supress the “stty: 'standard input': Inappropriate ioctl for device” error 获取 stty:标准输入:通过 ssh 隧道使用 scp 时设备的 ioctl 不合适 - Getting stty: standard input: Inappropriate ioctl for device when using scp through an ssh tunnel BLKRASET:设备的不适当的ioctl - BLKRASET: Inappropriate ioctl for device C ++不适用于设备的ioctl - c++ Inappropriate ioctl for device Linux内核模块/ IOCTL:设备的ioctl不合适 - Linux Kernel Module/IOCTL: inappropriate ioctl for device 尝试SSH时设备不正确的ioctl - Inappropriate ioctl for device when trying to SSH 在Python中运行ioctl会返回ENOTTY-设备不适合的ioctl - Running ioctl in Python returns ENOTTY - inappropriate ioctl for device 为 Linux 上的串行设备创建 sylink 时出现问题(`'Inappropriate ioctl for device'`) - Issue creating sylink for serial device on Linux (`'Inappropriate ioctl for device'`) root + chattr(读取...上的标志时,设备的ioctl不适当) - root+chattr(Inappropriate ioctl for device while reading flags on …) Gstreamer-无法枚举视频格式,并且设备错误的ioctl不正确 - Gstreamer- failed to enumerate video formats and Inappropriate ioctl for device Error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM