Quick shell scripting question

Discussion in 'Mac Programming' started by Objectivist-C, Aug 8, 2007.

  1. macrumors 6502

    Joined:
    Jul 1, 2006
    #1
    I wrote a script to keep some of the open-source software I use up-to-date. For those using subversion repositories, is there a way to branch the script depending on whether or not a new revision was detected, and similarly, to branch it depending on whether or not the Xcode build succeeds? Script follows below (feel free to point out any newbie mistakes):

    Code:
    #! /bin/bash
    
    cd /Volumes/External/src/gears
    svn update
    cd /Volumes/External/src/gears/base/safari/project/
    xcodebuild
    
    cd /Volumes/External/src/adium
    svn update
    xcodebuild
    cp -RLf build/Development/Adium.app /Applications
    
    cd /Volumes/External/src/Transmission
    svn update
    xcodebuild
    cp -RLf macosx/Transmission.app /Applications
    
    cd Desktop/Inbox/
    wget -r http://ftp.mozilla.org//pub/mozilla.org/camino/nightly/latest-1.6-M1.8/Camino.dmg
    open Camino.dmg
    cp -RLf /Volumes/Camino/Camino.app /Applications/Browsers
    hdiutil detach /Volumes/Camino/
    mv Desktop/Inbox/Camino.dmg ~/.Trash/
    
    exit
     
  2. thread starter macrumors 6502

    Joined:
    Jul 1, 2006
    #2
    Also, on the same subject, how would one go about closing an application from a script without knowing the PID beforehand?

    EDIT: OK, I guess Applescript would do the trick, but out of curiosity, is there a bash-ier way of doing it?
     
  3. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #3
    Code:
    killall MyApp
    But that is like a force quit. You can probably make it safer by using the -SIGNAL option.
     
  4. thread starter macrumors 6502

    Joined:
    Jul 1, 2006
    #4
    Thanks.
     

Share This Page