I have a plist file as below
I want to get showName and videoYRLString then run
"curl $videURLString -o $showName"
to download files, but I am not sure hot to do, pls help me.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
* <dict>
* * <key>showName</key>
* * <string>Name1</string>
* * <key>videoURLString</key>
* * <string>http://ip1/file1.txt</string>
* </dict>
* <dict>
* * <key>showName</key>
* * <string>Name2</string>
* * <key>videoURLString</key>
* * <string>http://ip2/file2.txt</string>
* </dict>
</array>
</plist>
"curl $videURLString -o $showName"
to download files, but I am not sure hot to do, pls help me.
Code:
plistfile="${HOME}/Downloads.plist"
showName="$(/usr/libexec/PlistBuddy -c "Print" "${plistfile}" | awk '/showName = /{print $3}' | awk -F' ' '{print $1}')"
videoURLString="$(/usr/libexec/PlistBuddy -c "Print" "${plistfile}" | awk '/videoURLString = /{print $3}' )"
printf "%s\n" "${showName[@]}"
printf "%s\n" "${videoURLString[@]}"*