I'm trying to find a way to automatically launch a command when Terminal is run, but:
- Have the Terminal window close after command has returned control to it / after (using &) after command has started launching.
- Not have the user change any settings themselves / not have the settings changed globally.
I have found (mainly from a relatively very comprehensive write-up on http://docstore.mik.ua/orelly/unix3/mac/ch01_03.htm) the ability to create a .terminal file and edit the contents (plist) to contain xml like the below.
<key>ExecutionString</key>
<string>ssh xyzzy.oreilly.com; exit</string>
However:
- Given the date of other postings (on google) showing this functionality
- The fact that the procedure which I eventually found to create custom Terminal windows, was subtly different from the instructions in the article above
- The fact that (at least with OSX10.5) they are now .term files (and complain that the file is not executable if changed to .terminal)
... am guessing that some version of OSX, post all the information I can find on this technique, changed this functionality. Is this correct in any version of OSX 10.5+?
Also, is there still a way to launch a command automatically in a custom terminal window (or similar, that isn't AppleScript / Automater / etc)?
arch
programs functionality to run properly, so the .command program is run ad-hoc. However, unless the user has set the Terminal program to close on shell closure (either with the condition of last command finishing cleanly, or not), the best we can do isexit
and have the Terminal window stay open with[Process Completed]
in it, which seems pointless as our program doesn't output anything to stdout. A custom terminal with the above xml seems to be ideal.