Skip to content

Instantly share code, notes, and snippets.

@soundsnw
Created February 27, 2020 22:49
Show Gist options
  • Save soundsnw/ba6e0b1b7c6a495b188a49483f3c53c9 to your computer and use it in GitHub Desktop.
Save soundsnw/ba6e0b1b7c6a495b188a49483f3c53c9 to your computer and use it in GitHub Desktop.
#!/bin/sh
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# Check if Preview.app is the default PDF reader
loggedInUser=$(scutil <<<"show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/ { print $3 }')
if [[ ! $(/usr/bin/sudo -u "$loggedInUser" /usr/local/orgutils/swda getUTIs | grep com.adobe.pdf | grep Preview) ]]; then
echo "<result>No</result>"
else
echo "<result>Yes</result>"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment