Dear all,
here comes my first approach for a BASH function to export <key>=<value> out from a property list.
# # exportpl set BASH variables according to the property list <key>=<value> # # if <value> is an array tag a BASH array will be returned # if <value> is a date tag output format YYYY-MM-DDTHH:MM:SSZGMTshift # # all variable values are UTF-8 encoded # # if a given key is not specified in plist an empty string will be returned # # each variable is named TMD_<key> (with prefix TMD_) # # Usage: # # exportpl <data|file> {key1 key2 key3 ... keyn} # # data := string containing valid plist data # file := plist file [.plist extension is not necessary] # key1...keyn :=?valid key(s) for plist # # # Examples: ('output' is an array with 8 items) # # a) # KEY=("returnCode" "output") # . "$TM_BUNDLE_SUPPORT"/bin/exportpl.sh "$TM_BUNDLE_SUPPORT"/bin/test.plist ${KEY[@]} # echo $TMD_returnCode # echo ${TMD_output[0]} # # # # b) # . "$TM_BUNDLE_SUPPORT"/bin/exportpl.sh "$TM_BUNDLE_SUPPORT"/bin/test returnCode output # echo $TMD_returnCode # echo ${TMD_output[5]} # # c) # DIA=$( cat "$TM_BUNDLE_SUPPORT"/bin/test.plist | tm_dialog -m test ) # . "$TM_BUNDLE_SUPPORT"/bin/exportpl.sh "$DIA" # #all key(s) for $DIA are exported #
What should I add/change/etc. ?
I used the objectC2Perl bridge to parse the plist data. The only thing I don't know yet whether the perl library 'Foundation' is installed as default. Tomorrow I will check this at a fresh Mac installation without 'Developer Toolkit'.
Cheers,
Hans-Jörg
---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.