OSX - How to auto Close Terminal window after the “exit” command executed.

前端 未结 14 1229
孤独总比滥情好
孤独总比滥情好 2020-12-12 16:02

When I\'m done with Terminal, I want to exit it. Right now, I have three options:

  1. killall Terminal. It will end the process, but rather abruptly. I don\'t t

14条回答
  •  渐次进展
    2020-12-12 16:33

    In a terminal window, you can type:

    kill -9 $(ps -p $PPID -o ppid=)
    

    This will kill the Terminal application process, which is the parent of the parent of the current process, as seen by the kill command.

    To close a Terminal window from within a running script, you need to go up one more level in the process hierarchy like this:

    kill -9 $(ps -p $(ps -p $PPID -o ppid=) -o ppid=) 
    

提交回复
热议问题