Gnome-конечный Command to exit and then relaunch that хан be executed from gnome-конечный?

I was wondering if it is possible to sort of restart gnome-terminal from itself? What I мочатся by that is, is there в command which I хан использовал to tell gnome-terminal to close and then immediately relaunch itself? I have tried running:

exit && gnome-terminal

But that doesn't work because after it I - exited it can't launch itself from itself, so was wondering if there is another command which will close it but also instruct another program to then immediately open it again?


ВЫ Information:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 15.10
Release:    15.10
Codename:   wily
Flavour: GNOME
GNOME Version: 3.18

Package Information:

gnome-terminal:
  Installed: 3.18.2-1ubuntu2~wily1
  Candidate: 3.18.2-1ubuntu2~wily1
  Version table:
 *** 3.18.2-1ubuntu2~wily1 0
        500 http://ppa.launchpad.net/gnome3-team/gnome3-staging/ubuntu/ wily/main amd64 Packages
        100 /var/lib/dpkg/status
     3.16.2-1ubuntu4 0
        500 http://archive.ubuntu.com/ubuntu/ wily/main amd64 Packages
1
задан 2 December 2015 в 22:35

2 ответа

Необходимо "отсоединить" недавно порожденное окно терминала. Теперь, какая команда делает это? nohup или setsid

nohup gnome-terminal && exit

setsid gnome-terminal && exit

4
ответ дан 3 December 2019 в 06:20

trap псевдосигнал EXIT:

trap 'gnome-terminal' EXIT

Теперь каждый раз Вы работаете exit, новый экземпляр gnome-terminal будет открыт оболочкой, и существующая сессия оболочки будет завершена.

<час>

Как @Byte Командующий указал, если Вы делаете exit (как Вы делали), или нажмите Ctrl + D для выхода из оболочки, вышеупомянутое создало бы gnome-terminal окно с тем же PID как более ранний (хотя оболочка получит другой PID), это поведение дизайном. Таким образом, чтобы уничтожить ток gnome-terminal процесс и запустить новый, можно сделать:

trap 'kill $(ps -o ppid= $) && gnome-terminal' EXIT
6
ответ дан 3 December 2019 в 06:20

Другие вопросы по тегам:

Похожие вопросы: