hi all,
i have 2 user profiles (fred, fredmoo) with filevault 2 enabled.
i have the following bash:
----------------
if i do echo userName, i get -----> fred
if i do echo userCheck, i get -----> fred fredmoo
------------------
the conditional statement above works well if there's only 1 profile. Unix or Linux Image
however since my mac has more than 1 user profiles, the statement will echo "This user is not a FileVault 2 enabled user." and exit.
userCheck has both profiles.
how do i modify the if statement to say if userName does NOT equal to the 1st userCheck or 2nd userCheck, then echo "This user is not a FileVault 2 enabled user." and exit?
i would appreciate any assistance. thanks so much!
i have 2 user profiles (fred, fredmoo) with filevault 2 enabled.
i have the following bash:
Code:
## Get the logged in user's name
userName=$(/usr/bin/stat -f%Su /dev/console)
## This first user check sees if the logged in account is already authorized with FileVault 2
userCheck=`fdesetup list | awk -v usrN="$userName" -F, 'index($0, usrN) {print $1}'`
if [ "${userCheck}" != "${userName}" ]; then
echo "This user is not a FileVault 2 enabled user."
exit 3
fi
if i do echo userName, i get -----> fred
if i do echo userCheck, i get -----> fred fredmoo
------------------
the conditional statement above works well if there's only 1 profile. Unix or Linux Image
however since my mac has more than 1 user profiles, the statement will echo "This user is not a FileVault 2 enabled user." and exit.
userCheck has both profiles.
how do i modify the if statement to say if userName does NOT equal to the 1st userCheck or 2nd userCheck, then echo "This user is not a FileVault 2 enabled user." and exit?
i would appreciate any assistance. thanks so much!
Last edited by a moderator: