PDA

View Full Version : Quick shell scripting question




Objectivist-C
Aug 8, 2007, 05:03 PM
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):

#! /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



Objectivist-C
Aug 10, 2007, 06:42 PM
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?

kainjow
Aug 10, 2007, 07:40 PM
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?

killall MyApp

But that is like a force quit. You can probably make it safer by using the -SIGNAL option.

Objectivist-C
Aug 16, 2007, 10:55 PM
Thanks.