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 mistake? How to resolve it?

+3
source share
1 answer

I think the problem is what you are reading from the redirected STDIN (because you are <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.

+3
source

Source: https://habr.com/ru/post/1771698/


All Articles