我通常是用"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的內容)
--
All Comments