开发者

What's the difference between STDIN and tty at all?

开发者 https://www.devze.com 2023-03-23 13:18 出处:网络
开发者_开发问答Tt seems to be the same whether I read from STDIN and /dev/tty, so what\'s the difference at all?/dev/tty is the controlling terminal for the current process. STDIN is the current inpu
开发者_开发问答

Tt seems to be the same whether I read from STDIN and /dev/tty,

so what's the difference at all?


/dev/tty is the controlling terminal for the current process. STDIN is the current input. If you redirect, e.g.,

perl script.pl <myfile.txt

STDIN will now come from myfile.txt, but /dev/tty would still come from the controlling terminal. It's all UNIX, not Perl, and there is much more to it than that, but that's the difference in a nutshell.

0

精彩评论

暂无评论...
验证码 换一张
取 消