The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Operating Systems > OS X (Apple)
.
google unix.com



OS X (Apple) OS X is a line of Unix-based graphical operating systems developed, marketed, and sold by Apple.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
run script through terminal sadiquep Linux 5 09-24-2008 08:44 AM
Running a script without a terminal session jjinno Shell Programming and Scripting 3 10-03-2007 02:50 AM
Script to launch terminal window? omerta SUN Solaris 5 06-30-2005 06:48 PM
Run the start script from the terminal? Newbie Time! waking_bear UNIX for Dummies Questions & Answers 4 03-04-2004 07:09 PM
connecting to unix through hyper terminal - as a dumb terminal michelle UNIX for Advanced & Expert Users 2 11-05-2001 03:32 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-01-2006
black-eyed-dog black-eyed-dog is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 3
Question Terminal script

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.
  #2 (permalink)  
Old 09-01-2006
Hitori's Avatar
Hitori Hitori is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2006
Posts: 360
Why not to do this when you enter runlevel 5?
  #3 (permalink)  
Old 09-01-2006
black-eyed-dog black-eyed-dog is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 3
Quote:
Originally Posted by Hitori
Why not to do this when you enter runlevel 5?
Sorry, that's way beyond my experience right now. I don't even properly understand what you mean! Can you explain?
  #4 (permalink)  
Old 09-01-2006
Hitori's Avatar
Hitori Hitori is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2006
Posts: 360
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)
  #5 (permalink)  
Old 09-01-2006
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,245
Here is what happens when OS X boots:

http://www.kernelthread.com/mac/osx/arch_startup.html
  #6 (permalink)  
Old 09-08-2006
[MA]Flying_Meat [MA]Flying_Meat is offline
Registered User
  
 

Join Date: Sep 2002
Location: San Fran
Posts: 131
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.
  #7 (permalink)  
Old 12-09-2008
glev2005 glev2005 is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 74
I dont have a mac infront of me so I cant test but..

#!/bin/bash
open /Applications/Terminal.app &

maybe that will work, I dont know.. you can save it as a .sh file, then run chmod +x on it (I'm not sure that is even necessary, but shouldnt hurt).. then you can add it as a launchd item which I am not able to explain right now.. hopefully this info will help somewhat.

OR... just go to system prefs/accounts and add Terminal.app to your login items and check the hide box.. probably the easiest way.

Last edited by glev2005; 12-10-2008 at 06:52 PM..
Closed Thread

Bookmarks

Tags
linux, linux commands, shell script, shell scripting, unix scripting, unix scripting basics

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:16 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0