With xterm
(and gnome-terminal
, terminator
, etc), you can run the following command:
$ xterm -e 'vim somefile.txt'
xterm will open and run the specified program (in this case, Vim). When the program exits, the terminal window closes as well. Running the above command, if you were to quit Vim, the terminal would go away as well.
Is there any way to get this (or similar) functionality through Terminal.app (on OSX)? The solution can be in AppleScript, Bash or anything else really, as long as it's achievable via commands I could run in a Bash script.
Best Answer
With AppleScript, you can do:
This will open Terminal and tell it to run a command (Your default settings need to close the window when the shell exits). To run this, just use
osascript filename.scpt "$command_to_run"