I'm trying to parse the output from hdiutil using PlistBuddy on the Mac terminal (without using a temporary file) and I'm running into some issues. I've tried the following:
Command 1
hdiutil info -plist | PlistBuddy -c "Print"
Output:
Prints the help for PlistBuddy
Command 2
PlistBuddy -c "Print" $(hdiutil info -plist)
Output:
File Doesn't Exist, Will Create: <?xml
Invalid Arguments
I'm not great at bash but I think it might be an issue with PlistBuddy not accepting STDIN but only .plist files as input. Is there something that I'm missing or do I have to create a temporary file?
var=$(hdiutil info -plist)
PlistBuddy -c "Print" /dev/stdin <<< "$var"