2010-10-27 81 views
3
perl script.pl --f1="t1" --f2="t2" --f3="t4" --f4 < /home/joe/a.txt 

script.pl的stty:標準輸入:不適當的IOCTL用於設備

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'); 
} 

我得到這個錯誤:

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

這是什麼錯誤?我如何解決它?

+0

第一步是向我們展示腳本正在做什麼導致該錯誤,即:「script.pl」的相關位 – mfontani 2010-10-27 12:07:14

+0

我已更新問題 – Tree 2010-10-27 12:19:39

回答

3

我認爲這個問題是您從重定向標準輸入讀(因爲你< file.txt的)

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

你或許應該通過你的文件作爲參數傳遞給您的腳本。

相關問題