如何判斷是否正在tty下使用screen/tmux - Linux

By Una
at 2011-09-21T00:17
at 2011-09-21T00:17
Table of Contents
我通常是用"tty"這個指令判斷是否正在tty下
例如
1. 在tty(1~6)時(假設在tty1)
user@local_host:~$ tty
/dev/tty/1 => tty
2. 在x11中使用gnome-termial時
user@local_host:~$ tty
/dev/pts/7 => pts
3. 用putty遠端到遠端Linux伺服器時
user@remote_host:~$ tty
/dev/pts/10 => pts
4. 在gnome-terminal中使用screen/tmux時
user@local_host:~$ tty
/dev/pts/8 => pts
不過
5. 在tty(1~6)中使用screen/tmux時
user@local_host:~$ tty
/dev/pts/8 => 恩...好希望它顯示的是tty = =
我希望在情況5.中, 能判斷出"我正在tty使用screen/tmux"
然而此時"tty"這個指令似乎就沒用了
請問有甚麼其他判斷方法嗎
(除了印出$TERM之外
因為不論是在x或tty中attach screen, $TERM的內容都是一樣的
還有我不希望手動調整$TERM的內容)
--
例如
1. 在tty(1~6)時(假設在tty1)
user@local_host:~$ tty
/dev/tty/1 => tty
2. 在x11中使用gnome-termial時
user@local_host:~$ tty
/dev/pts/7 => pts
3. 用putty遠端到遠端Linux伺服器時
user@remote_host:~$ tty
/dev/pts/10 => pts
4. 在gnome-terminal中使用screen/tmux時
user@local_host:~$ tty
/dev/pts/8 => pts
不過
5. 在tty(1~6)中使用screen/tmux時
user@local_host:~$ tty
/dev/pts/8 => 恩...好希望它顯示的是tty = =
我希望在情況5.中, 能判斷出"我正在tty使用screen/tmux"
然而此時"tty"這個指令似乎就沒用了
請問有甚麼其他判斷方法嗎
(除了印出$TERM之外
因為不論是在x或tty中attach screen, $TERM的內容都是一樣的
還有我不希望手動調整$TERM的內容)
--
Tags:
Linux
All Comments

By Erin
at 2011-09-23T19:56
at 2011-09-23T19:56

By Puput
at 2011-09-26T11:48
at 2011-09-26T11:48

By Puput
at 2011-09-27T23:54
at 2011-09-27T23:54

By Quanna
at 2011-10-01T13:38
at 2011-10-01T13:38

By Edward Lewis
at 2011-10-02T23:08
at 2011-10-02T23:08

By Connor
at 2011-10-07T08:35
at 2011-10-07T08:35

By Todd Johnson
at 2011-10-10T08:22
at 2011-10-10T08:22

By Eartha
at 2011-10-12T04:04
at 2011-10-12T04:04

By Xanthe
at 2011-10-13T06:19
at 2011-10-13T06:19

By Vanessa
at 2011-10-13T12:30
at 2011-10-13T12:30

By Mason
at 2011-10-16T00:46
at 2011-10-16T00:46

By Donna
at 2011-10-18T16:44
at 2011-10-18T16:44

By Cara
at 2011-10-19T05:09
at 2011-10-19T05:09

By Zenobia
at 2011-10-20T05:56
at 2011-10-20T05:56

By Isla
at 2011-10-24T10:44
at 2011-10-24T10:44
Related Posts
BBS字型

By Frederic
at 2011-09-20T23:52
at 2011-09-20T23:52
Vmware的centos 6 桌面沒東西

By Agnes
at 2011-09-20T21:03
at 2011-09-20T21:03
如何讓ls -l的結果依照數字遞增排序

By Ingrid
at 2011-09-20T16:24
at 2011-09-20T16:24
誤改檔名後如何快速改回來

By Selena
at 2011-09-20T15:31
at 2011-09-20T15:31
mplayer編譯問題

By Frederic
at 2011-09-20T07:40
at 2011-09-20T07:40