Created
February 22, 2017 03:17
-
-
Save napisani/bbc1a815f65d3c98757f3c66c8eac476 to your computer and use it in GitHub Desktop.
fix spotlight index of cask apps by creating alias files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mdfind "kMDItemKind == 'Alias'" -onlyin /Applications/ | while read x ; do rm -f "$x" ; done | |
find /usr/local/Caskroom -name "*.app" | grep -E "/latest/[^/]*.app$" | while read x ; do | |
echo "$x" | |
SHORT=`echo $x | sed s/.app//g | sed 's/.*\/latest\///g' | sed 's/ /_/g' | awk '{print tolower($0)}' ` | |
echo "$SHORT" | |
osascript<<EOF | |
set $SHORT to POSIX file "$x" | |
set applications_folder to POSIX file "/Applications" | |
tell application "Finder" | |
make alias file to $SHORT at applications_folder | |
end tell | |
EOF | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment