How do I get a Mac “.command” file to automatically quit after running a shell script?

前端 未结 7 2181
隐瞒了意图╮
隐瞒了意图╮ 2021-02-06 23:47

In my shell script, my last lines are:

...
echo \"$l\" done
done

exit

I have Terminal preference set to \"When the shell exits: Close the wind

7条回答
  •  隐瞒了意图╮
    2021-02-07 00:28

    I was finally able to track down an answer to this. Similar to cobbal's answer, it invokes AppleScript, but since it's the only window that I'd have open, and I want to run my script as a quick open-and-close operation, this more brutish approach, works great for me.

    Within the ".command" script itself, "...add this line to your script at the end"

    osascript -e 'tell application "Terminal" to quit' &
    exit
    

    SOURCE: http://forums.macosxhints.com/archive/index.php/t-2538.html

提交回复
热议问题