|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| OS X (Apple) OS X is a line of Unix-based graphical operating systems developed, marketed, and sold by Apple. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I'd like to write a script that will run when I log into OS X, which will do the following:
1) Launch Terminal 2) Immediately close the window that Terminal creates when it opens. 3) Preferably, keep Terminal hidden while all this is happening, so all I see is the Terminal icon bouncing in the dock as the program launches. Any advice appreciated ![]() PS: I'd prefer the script to be a .sh or a .c file (to compile), as those are the only two languages I have some experience in at the moment. Thanks. |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Why not to do this when you enter runlevel 5?
|
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Quote:
|
|
#4
|
||||
|
||||
|
A runlevel is a software configuration of the system which allows only a selected group of processes to exist. The processes spawned by init process for each of these runlevels are defined in the /etc/inittab file. Runlevels 0, 1, and 6 are reserved. Other runlevels are dependent on how your particular distribution has defined them, and they vary significantly between distributions.
Most users run X from runlevels 3 or 5 (for linux?). Runlevel 3 places your system in multi-user mode with full networking capabilities. The machine will boot to a text-based login prompt with all necessary preconfigured services started. Most servers are run in runlevel 3, as X is not necessary to provide any services utilized by most users. Runlevel 5 is similar to 3, except that it automatically starts X and provides a graphical login screen. Many workstation users prefer this method, because it never forces them to see a command prompt. You can add commands that must be executed in appropriate runlevel in some file/under some directory (e.g. /etc/rc.d/rc5.d) |
| Sponsored Links | |
|
|
#5
|
||||
|
||||
|
|
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
It would be helpful to know why this operation is important because there may be a better way to accomplish the "why" than you might realize.
I can't image a use for having Terminal launch at startup without a window. Not that there isn't one, but I just can't imagine it. AppleScript can be used to hide a window, but the application first has to create the window (which displays on creation), then hide it immediately. The window is thus only visible for a split second. You can send applescript code from shell scripts using the osascript command (man osascript). You can examine Terminal's applescript functionality from within Script Editor.app by selecting "Open Dictionary..." from the Script Editor "File" menu, then navigating to Terminal.app. Otherwise, I don't know if this is possible from the command line. ![]() |
| Sponsored Links | |
|
|
#7
|
|||
|
|||
|
login hook ?
Maybe a login hook could do the trick?
sudo defaults write com.apple.loginwindow LoginHook /path/to/script (For more information see http://www.bombich.com/mactips/loginhooks.html and http://docs.info.apple.com/article.html?artnum=301446 ) Using AppleScript you could try something like this: osascript -e 'tell application "Terminal" to launch' -e 'tell application "System Events" to set visible of some item of ( get processes whose name = "Terminal" ) to false' Btw, you can 'reset' Terminal.app by deleting the Terminal.plist file: rm "$HOME/Library/Preferences/com.apple.Terminal.plist" |
| Sponsored Links | ||
|
![]() |
| Tags |
| linux, linux commands, shell script, shell scripting, unix scripting, unix scripting basics |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Terminal Command into script | ab52 | OS X (Apple) | 2 | 08-16-2011 11:31 AM |
| Script to run a command in a new terminal | sojo1024 | UNIX for Dummies Questions & Answers | 1 | 06-14-2011 03:33 PM |
| terminal script stops after script command :(. | drdread | OS X (Apple) | 6 | 02-04-2009 12:37 PM |
| run script through terminal | sadiquep | Linux | 5 | 09-24-2008 07:44 AM |
| connecting to unix through hyper terminal - as a dumb terminal | michelle | UNIX for Advanced & Expert Users | 2 | 11-05-2001 02:32 PM |
|
|