我有以下用于 OSX 的 shell 脚本,我想用它来更正/修复用户目录的权限,但出现错误:
bash-3.2# sh fix-perms.sh
fix-perms.sh: line 23: syntax error near unexpected token `else'
fix-perms.sh: line 23: `else'
我的脚本:
#!/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
这一定是我想念的愚蠢/愚蠢的东西,但如果我能看到它就该死!
提前感谢您的提示/见解。
担