var="keychain-access-groups"
declare -a val=$( /usr/libexec/PlistBuddy -c "Print $var" "sample.plist")
echo ${val}
echo ${val[0]}
输出:
Array { ABCD.com.bus.NoEntitlements ABCD.com.bus.sharing }
Array { ABCD.com.bus.NoEntitlements ABCD.com.bus.sharing }
如何获取数组中的第一项?