I’ve got the following shell script for OSX I want to use to correct/fix permissions for a user directory, but am getting the error:
bash-3.2# sh fix-perms.sh
fix-perms.sh: line 23: syntax error near unexpected token `else'
fix-perms.sh: line 23: `else'
My script:
#!/bin/sh
# Script fixes permissions in Users directory
# Set PATH as shortcut
#
PATH=/bin:/usr/bin:/sbin:/usr/sbin export PATH
# First verify volume is mounted before executing
if [ -d /Volumes/UserStorage ] ;
then
USERS=`mktemp -t users-XXXXX.log`
ls -1 /Volumes/UserStorage/Users > $USERS
for i in `cat $USERS`; do
chmod -R 700 /Volumes/UserStorage/Users/$i
find /Volumes/UserStorage/Users/$i -type d -exec chmod 701 {} \;
exit 0
else
echo Volume Not Mounted
exit 1
fi
It’s got to be something silly/stupid that I’m missing but darned if I can see it!
Thanks for your tips/insight in advance.
Dan
You forgot
donein yourforloop. The syntax is: