Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OSX Terminal close current tab from command line without prompt?

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'
like image 723
ehime Avatar asked Sep 08 '14 22:09

ehime


People also ask

How do I close a Terminal session?

End a terminal session by typing ~ [Enter] on a line by itself.

What happens when I close a Terminal window tab?

If you close the terminal you will kill any processes you started with it.

What does control d do in Terminal?

In the Linux command-line shell, pressing Ctrl + D logs out of the interface. If you used the sudo command to execute commands as another user, pressing Ctrl + D exits out of that other user and puts you back as the user you originally logged into. Linux shell tutorial.


1 Answers

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)
like image 179
jm666 Avatar answered Nov 15 '22 04:11

jm666