{"id":3674,"date":"2019-06-29T10:12:40","date_gmt":"2019-06-29T02:12:40","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=3674"},"modified":"2019-06-29T10:12:42","modified_gmt":"2019-06-29T02:12:42","slug":"tty","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/tty","title":{"rendered":"tty\u547d\u4ee4 – \u6253\u5370\u8f93\u51fa\u8fde\u63a5\u5230\u6807\u51c6\u8f93\u5165\u7684\u7ec8\u7aef\u6587\u4ef6\u540d"},"content":{"rendered":"\n

tty\u662f Teletype\uff08\u7535\u4f20\u6253\u5b57\u673a\uff09\u7684\u7f29\u5199\uff0c\u7535\u4f20\u6253\u5b57\u673a\u662f\u6700\u65e9\u51fa\u73b0\u7684\u4e00\u79cd\u7ec8\u7aef\u8bbe\u5907\uff0c\u73b0\u5728\u901a\u5e38\u4f7f\u7528 TTY \u6765\u7edf\u79f0\u5404\u79cd\u7c7b\u578b\u7684\u7ec8\u7aef\u8bbe\u5907\uff0c\u5982\u952e\u76d8 \u3001\u6253\u5370\u673a \u3001\u663e\u793a\u5668\u7b49\u3002<\/p>\n\n\n\n

pty\uff08\u865a\u62df\u7ec8\u7aef):\u00a0\u5982\u679c\u6211\u4eec\u8fdc\u7a0btelnet\u5230\u4e3b\u673a\u6216\u4f7f\u7528xterm\u65f6,\u4e5f\u9700\u8981\u4e00\u4e2a\u7ec8\u7aef\u4ea4\u4e92\uff0c\u8fd9\u5c31\u662f\u865a\u62df\u7ec8\u7aefpty(pseudo-tty) \u3002<\/p>\n\n\n\n

pts\/ptmx(pts\/ptmx\u7ed3\u5408\u4f7f\u7528\uff0c\u8fdb\u800c\u5b9e\u73b0pty):\u00a0pts(pseudo-terminal slave)\u662fpty\u7684\u5b9e\u73b0\u65b9\u6cd5\uff0c\u4e0eptmx(pseudo-terminal master)\u914d\u5408\u4f7f\u7528\u5b9e\u73b0pty\u3002<\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>tty [\u53c2\u6570] <\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n
-s\/--silent\/--quiet<\/td>\u65e0\u6253\u5370\u8f93\u51fa\u7ed3\u679c\uff0c\u53ea\u662f\u8fd4\u56de\u9000\u51fa\u72b6\u6001\u7801<\/td><\/tr>
--help<\/td>\u6253\u5370\u8f93\u51fatty\u547d\u4ee4\u7684\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa<\/td><\/tr>
--version <\/td>\u6253\u5370\u8f93\u51fa\u5f53\u524dtty\u547d\u4ee4\u7248\u672c\u4fe1\u606f<\/td><\/tr><\/tbody><\/table>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n

\u76f4\u63a5\u8f93\u5165tty\u547d\u4ee4\uff0c\u6253\u5370\u8f93\u8fde\u63a5\u5230\u5f53\u524d\u6807\u51c6\u8f93\u5165\u7684\u7ec8\u7aef\u8bbe\u5907\u6587\u4ef6\u540d\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# tty\n\/dev\/pts\/1<\/pre>\n\n\n\n

\u8f93\u5165”tty -s\/--silent\/--quiet”\u65e0\u76f4\u63a5\u8fd4\u56de\u7ed3\u679c\uff0c\u9700\u8981\u901a\u8fc7”echo $?”\u67e5\u770b\u8fd4\u56de\u7684\u9000\u51fa\u7801\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# tty -s\n[root@linuxcool ~]# echo $?\n0<\/pre>\n\n\n\n

\u9000\u51fa\u7801\u7684\u542b\u4e49\uff1a “0” \u8868\u793a\u6807\u51c6\u8f93\u5165\u662f\u4e00\u4e2a\u7ec8\u7aef\u3002 “1” \u8868\u793a\u6807\u51c6\u8f93\u5165\u4e0d\u662f\u4e00\u4e2a\u7ec8\u7aef\u3002” 2″ \u8868\u793a\u7ed9\u5b9a\u7684\u53c2\u6570\u662f\u4e0d\u6b63\u786e\u7684\u53c2\u6570\u3002 “3” \u8868\u793a\u53d1\u751f\u4e86\u5199\u9519\u8bef\u3002 <\/p>\n","protected":false},"excerpt":{"rendered":"

tty\u662f Teletype\uff08\u7535\u4f20\u6253\u5b57\u673a\uff09\u7684\u7f29\u5199\uff0c\u7535\u4f20\u6253\u5b57\u673a\u662f\u6700\u65e9\u51fa\u73b0\u7684\u4e00\u79cd\u7ec8\u7aef\u8bbe\u5907\uff0c\u73b0\u5728\u901a\u5e38\u4f7f\u7528 TTY \u6765\u7edf […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/3674"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=3674"}],"version-history":[{"count":3,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/3674\/revisions"}],"predecessor-version":[{"id":3704,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/3674\/revisions\/3704"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=3674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=3674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=3674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}