5

Looking for a way to close the current tab via the command line, I hashed this out, but end up getting a prompt for Do you really want to close which I would like to avoid. Here's my code,

osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "w" using command down'
ehime
  • 8,025
  • 14
  • 51
  • 110
  • Possible duplicate of [Close Terminal window from within shell script (Unix)?](http://stackoverflow.com/questions/8798641/close-terminal-window-from-within-shell-script-unix) – bob Mar 16 '17 at 17:17

1 Answers1

6

Why didn't use the:

Terminal.app -> Preferences -> Settings -> Shell

and for the items:

"When the shell exists:" Close if the shell exited cleanly
"Prompt before closing:" Only if there are...." (or Never)
clt60
  • 62,119
  • 17
  • 107
  • 194