mirror of
https://github.com/MLBZ521/MacAdmin.git
synced 2026-02-03 14:03:26 +00:00
23 lines
770 B
Bash
23 lines
770 B
Bash
#!/bin/bash
|
|
|
|
###################################################################################################
|
|
# Script Name: fix_UserHomeDirectory.sh
|
|
# By: Zack Thompson / Created: 1/11/2018
|
|
# Version: 1.0 / Updated: 1/11/2018 / By: ZT
|
|
#
|
|
# Description: This script fixes an incorrectly configured user account Home Directory
|
|
#
|
|
###################################################################################################
|
|
|
|
username="$4"
|
|
|
|
homeDir=$(/usr/bin/dscl . read /Users/$username/ NFSHomeDirectory | /usr/bin/awk -F ": " '{print $2}')
|
|
|
|
if [[ $homeDir == "//"* ]]; then
|
|
/bin/echo "Incorrect home directory... Fixing..."
|
|
/usr/bin/dscl . -change $homeDir NFSHomeDirectory $homeDir /Users/$username
|
|
fi
|
|
|
|
/bin/echo "Correct home directory set!"
|
|
|
|
exit 0 |