[英]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.