Close Terminal window from within shell script (Unix)?

前端 未结 6 981
无人共我
无人共我 2020-12-07 16:41

Is there a way to close a Terminal window from within a shell script? I have a .command file that should just get out of the way once it\'s done.

6条回答
  •  误落风尘
    2020-12-07 17:00

    I find the best solution for this is to use Automator to create a true OSX application which will work the same way regardless of how your system is configured. You can have the Automator run your shell script, or you can embed the shell script itself in Automator.

    Here is how you do it:

    1. Run Automator (in Applications).
    2. Choose "New Document" and when it asks "Choose a type for your document" choose "Application"
    3. In the left panel, select "Utilities" then "Run Shell Script".
    4. Type in your script commands in the workflow item in the right panel. You can either call another shell script, or just put your commands in their directly.
    5. Save the Application, which will be a full-fledged Mac App. You can even cut-and-paste icons from other apps to give your script some personality.

提交回复
热议问题