Networking | Hardware | Software | Multimedia | System | Unix&Linux | MBA

Home>>Unix&Linux>>Compare domain key of two Info.plist files

Compare domain key of two Info.plist files

leonida
03-22-2006, 02:20 PM
I need to compare a domain key (string) of two different Info.plist files.
That is if keys are equal than statement A else statement B.
Something like this:

if defaults read "domainA" "key" == defaults read "domainB" "key" ; then
statement A
else
statement A
fi
How to get this?
Thanks, L.

giskard22
03-22-2006, 02:38 PM
You can enclose a statement in ` characters if you want the shell to run it and use the result. For example: echo `whoami` returns your username, whereas echo whoami returns "whoami".

hayne
03-22-2006, 02:42 PM
I suspect that you need a tutorial on shell scripting - see the last section of this Unix FAQ (http://forums.macosxhints.com/showthread.php?t=40648)

leonida
03-22-2006, 03:07 PM
Thanks for your clues and this how-to (http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-6.html#ss6.1). I've solved in this way:

T1=`defaults read "domainA" "key"`
T2=`defaults read "domainB" "key"`
if [ "$T1" = "$T2" ]; then
echo expression evaluated as true
else
echo expression evaluated as false
fi


 

TOP

Windows Server Outsell
Unix Signals And C++ E

For more info

Unix Signals And C++ E
Windows Server Outsell
bash not using my .bas
Applescript: Hide Proc
help with installing p
Mozilla install from d
ssh - don't want to us
Escaping quotes in Tig
Terminal Keybindings 
JAVA help, please! 

News Archive

Displaying Images on t
Install Office from th
Terminal Problem...? 
cc1plus not executable
desktop icons.. 
at & growlnotify 
unknown terminal type 
scp arbitrary files 
What and why is a 'Dis
permissions already me

Related stories:

Applescript to quit Entourage?
Zip up a file from shell script
X11 Mode and Gnome Questions
Batch Modifying Modification Dates
mac image burning
DarwinPorts funkiness
cd to front Finder window

Copyright@2004-2005 www.zzcoke.com All Right Reserved

advanced web statistics