Pretty basic question about shell scripting. I'm writing a script to check the current logged in user and delete the dock.plist in that users folder if the current user is a generic library account. Our generic accounts all end in lib, such as:
bolib
celib
hmlib
crlib
Here is my script, although I'm always getting the else outcome:
#!/bin/bash
##This script will delete the com.apple.dock.plist on logout for generic
##library accounts. A new default dock will be loaded on the next login.
##First, we need the currently logged in user
currentuser=`who | grep console | awk '{print $1}'`
##If the current user is a library account, delete the com.apple.dock.plist
if [ "$currentuser" == *"lib" ]; then
rm /Users/$currentuser/Library/Preferences/com.apple.dock.plist
else
echo "Dock not deleted. Not a library account."
fi
I'm guessing it has something to do with the wildcard in the if statement but any suggestions are appreciated.