Posted on 11-14-2017 05:54 PM
I hoping by the end of this thread someone will be able to tell me why this script isn't working. Hoping once it has been fixed, others will use as needed. Thank you - this just fails.
loggedInUser=/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'
rm -rf /Applications/FileMaker Pro 12/FileMaker Pro.app
rm -rf /Applications/FileMaker Pro 13/FileMaker Pro.app
rm -rf /Applications/FileMaker Pro 14/FileMaker Pro.app
rm -rf /Applications/FileMaker Pro 15/FileMaker Pro.app
exit 0
Posted on 11-14-2017 07:00 PM
@jgwatson When pasting a script, use three consecutive backpack characters (```) before and after the script so the forum software displays it as code.
To answer your question, when working with files that have spaces in their names you either need to quote the name or escape the space:rm -rf /Applications/FileMaker Pro 12/FileMaker Pro.app
or rm -rf "/Applications/FileMaker Pro 12/FileMaker Pro.app"
A couple of other minor nits: There is no need for determining the logged in user in that script, and you only want one #!/bin/...
in your script
Posted on 11-15-2017 01:12 AM
I don't know how FileMaker is being installed, but you might have other directories or the package receipts that you might want to remove. I have seen some un-install scripts that leave a lot of stuff on the Mac. It rarely does harm, but it can be confusing - in particular when you use the existence of a receipt as indicator for the existence of the software.
Is there a reason that you want to keep "/Applications/FileMaker Pro 12" and other files or directories that might be in there, and only remove "/Applications/FileMaker Pro 12/FileMaker Pro.app"? To me it seems more logical to remove the complete "/Applications/FileMaker Pro 12".
I always would check first whether a directory exists before boldly running the command to remove it. So I would do
#!/bin/sh
for theDir in /Applications/FileMaker Pro 12 /Applications/FileMaker Pro 13 /Applications/FileMaker Pro 14 /Applications/FileMaker Pro 15; do
if [ -d "$theDir" ]; then
/bin/rm -rf "$theDir"
fi
done
Hope this helps.
Posted on 11-15-2017 12:12 PM
Thanks @mschroder , apologies for being a pain, but how would I go about deleting the icon from the dock if it was there?
What would that line look like?
Thanks
Posted on 11-16-2017 05:52 AM
Hm, that is a very good question, unfortunately I don't know how to do that. But in fact it would be a good idea to check whether the icon is in the dock, and in that case remove it. I had never thought about that one...
Posted on 11-16-2017 06:52 AM