I have upgraded version of application. i want to remove old version from all user's also from Dock and install new version. package name is Yammer. and that is not pkg file. this is .app. old package location is ~/Application folder. i want to place new package to /Application for all user's. using below preinstall script for remove application. it is removing app for all users but yammer icon still in Dock showing. once i click on that showing question mark. tell me where i'm doing wrong.
dockutil --remove 'Yammer'
for i in /Users/*
do if [ -f $i/Applications/Yammer.app/Contents/MacOS/Yammer ] then rm -rf $i/Applications/Yammer.app fi