User-agent: Mozilla Thunderbird 1.0.6 (Macintosh/20050716)
I suppose there's some way to use a fancy API, or a full XML parser, etc.
However, I did have this need in my project, and I just wrote a script
that pulled the information out of the text, using some reasonable
method for determining where the data is.
I've included it below. :)
Kevin G.
-----------
#!/bin/sh
# VersionInfo.sh
#
# Parses the built executable's Info.plist file and finds the 5
# major version components, printing them out in order and space-
# delimited.
#
# Kevin Grant (email@hidden)
# June 17, 2004
if [ ! -r ./VersionInfo.sh ] ; then
echo "$0: run this from the Tools/Application directory"
exit 1
fi
# extract version components from Info.plist's XML
$grep '<string>.*\..*\..*\..*\..*'
${BIN}/../../Build/Application/MacTelnet.app/Contents/Info.plist | $perl
-ne 's/\s*<\/?string>\s*//g; pri
nt' | $awk 'BEGIN { FS = "." } { print $1" "$2" "$3" "$4" "$5 }'
Gang,
First off, sorry if this is an inappropriate question for this list -
I scanned the apple lists but didn't see a list that this should
obviously to go (feel free to correct me and I'll redirect my
question there)...
That said, what is the best way to get the version of a bundled
object (.app or .bundle, etc) in a BASH shell script?
I'm pretty new to bash scripting and don't know what is the best
approach. Is there a mac specific cmd for auto reading the version
info from a bundle's info.plist? Or do I have to manually open the
info.plist? If so, are there commands that'll do the xml parsing of
the file for me? Or do I need to manually parse for the version info?
I appreciate the feedback of those more savvy than I.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden