Running a shell script at application launch

Discussion in 'Mac Programming' started by 051r15, Mar 15, 2011.

  1. 051r15 macrumors newbie

    Joined:
    Mar 15, 2011
    #1
    Hi forums, this is my first post! Im trying to run this script automatically when I launch terminal :

    /System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background

    it's a matrix digital rain screensaver I'd like to run in the background when terminal is launched, purely to show off. Can this be done in automator? If so, how would I go about doing that? I've looked around google, and not found anything useful.

    Thanks in advance for any help! I will try and return the favor sometime.
     
  2. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #2
    One possible way:

    1. Terminal | Preferences
    2. Settings
    3. Select whichever is the default settings
    4. Shell
    5. Run command
    6. Paste your command then put a space followed by a &
    7. Run inside shell

    Then next time a Terminal window is opened the command will run in the (process) background.
     
  3. 051r15 thread starter macrumors newbie

    Joined:
    Mar 15, 2011
    #3
    Right on! Many thanks! The effect is cold-blooded :cool: . So does the "&" at the end tell the application to stop the script upon quitting? That's the effect I was going for, hadn't yet found the right command... Again, thanks a million!
     
  4. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #4
    No the & tells it to detach the task from the console and let it run in the background. http://en.wikipedia.org/wiki/Ampersand#Unix_shells Closing the process that launched it may have a side effect of killing the background job too, but that's not what the & is meant for.

    B
     
  5. 051r15 thread starter macrumors newbie

    Joined:
    Mar 15, 2011
    #5
    Okay, here's the full command, along with a screenshot of the screensaver and color of terminal at once. Quite the effect, especially with the voice.

    /System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background & say -v zarvox nooobs sayonara all your base are belong to us ich nii saan shi destroy

    Hillarious!:D

    http://img146.imageshack.us/i/deske.png/
     
  6. 051r15 thread starter macrumors newbie

    Joined:
    Mar 15, 2011
    #6
    Thanks for the link and clarification on the "&". I'm trying to seriously beef up the command line skills.
     

Share This Page