為什麼新終端機會自動關閉?

為什麼新終端機會自動關閉?

每次我打開一個新終端時,它都會自動關閉。我正在運行 Arch Linux 和 Xforce4 終端。

$ terminal --execute sudo arpspoof -i $(cat var.log|awk '{print $1}') \
           -t $(cat var.log|awk '{print $4}') $(cat var.log|awk '{print $3}')

或者

# terminal --execute arpspoof -i $(cat var.log|awk '{print $1}') \
           -t $(cat var.log|awk '{print $4}') $(cat var.log|awk '{print $3}')

執行上述任一指令時列印錯誤:

Unable to register terminal service: Did not receive a reply. Possible causes
include: the remote application did not send a reply, the message bus security
policy blocked the reply, the reply timeout expired, or the network connection
was broken.

答案1

終端的「預設」行為是在指示其運行的程式完成時終止。這樣做是因為這是最實際的事。如果您希望在輸出消失之前讀取輸出,請考慮在末尾添加一個命令,如下所示:

urxvt -e sh -c 'cowsay howdy?; sleep 1337'

某些終端機(例如 rxvt-unicode)可以選擇保留,直到被視窗管理器關閉:

-hold|+hold
    Turn on/off hold window after exit support. If enabled, urxvt will 
    not immediately destroy its window when the program executed within 
    it exits.  Instead, it will wait till it is being killed or closed by 
    the user; resource hold.

相關內容