Login, Once Per Computer
#!/bin/sh
rm -R "~/Library/Preferences/com.apple.garageband.plist"
#!/bin/bash
for dir in /Users/*; do
if [[ -e "${dir}/Library/Preferences/com.apple.garageband.plist" ]]; then
rm "${dir}/Library/Preferences/com.apple.garageband.plist"
fi
done
Alternatively, you could just pull a working plist from a new user and push it out with FEU checked.
Hello all, having a similar issue. I am trying to remove the below file from the library for all users on the computer through a bash script but the wildcard does not seem to do anything. Testing the script locally by running it on mac os x terminal.
File to be deleted: com.apple.eap.bindings.XXXXXXX.plist
#!/bin/bash
for dir in /Users/*;
do
if [[ -e "${dir}/Library/Preferences/com.apple.eap.bindings.*" ]]; then
rm "${dir}/Library/Preferences/com.apple.eap.bindings.*"
fi
done
The script just doesn't delete the required file. I tried removing the quotes as well and still won't delete. What am I doing wrong here please?
Thanks.
Test before implementing, but this worked for me--running as root:
#!/bin/bash
for user in /Users/*
do
for f in "$user"/Library/Preferences/com.apple.eap.bindings.*
do
if [ -e "$f" ];then
echo "Removing $f"
rm $f
else
echo "Files not found in $user"
fi
sleep 1
done
done
Why not just use:
rm -f /Users/*/Library/Preferences/com.apple.eap.bindings*
Bash will expand it as necessary.
@mgrev
Just for future searchers as I am looking for something from an old thread I participated in and came across this.
The * needs to be outside the quotes.
And @Aaron has the better method for this use case.
@mgrev @jacob_salmela I attempted running both of your bash scripts to no avail. The files I am targeting are Microsoft plist files within the CrashReporter folder of each user's home directory.
The issue is: I am not getting any error/syntax messages, yet the plist files remain.
@jacob_salmela's script returns that the "files not found", as the script dictates. @mgrev's script returns nothing, but removes nothing. The separate scripts are below.
#!/bin/sh
for dir in /Users/*
do
for f in "$dir"/Library/Application Support/CrashReporter/Microsoft*
do
if [ -e "$f" ];then
echo "Removing $f"
rm -f $file
else
echo "Files not found in $dir"
fi
sleep 1
done
done
#!/bin/sh
for dir in /Users/*
do
if [[ -e "${dir}/Library/Application Support/CrashReporter/Microsoft Word_"* ]]; then
rm "${dir}/Library/Application Support/CrashReporter/Microsoft Word_"*;
fi
done
I have tried multiple variations of both; moving wildcards and trying different flags. Any help would be appreciated.