我正在尝试创建一个脚本,该脚本将在主目录中显示所有组和世界可写的文件。
警告:如果您在本地运行,该脚本将无限循环地运行未找到的文件。
#!/bin/ksh
lsuser -a home ALL |cut -f2 -d= | while read HOMEDIR; do
if [ -d $HOMEDIR ]; then
ls -a $HOMEDIR | grep -Ev "^.$|^..$" | while read FILE; do
[[ "$(ls -ld ${FILE})" = @(????????w? *) ]] && print " WARNING ${FILE} is world wr
itable"
[[ "$(ls -ld ${FILE})" = @(?????w???? *) ]] && print " WARNING ${FILE} is group wr
itable"
done
else
echo "No home dir for $HOMEDIR"
fi
done
任何指针?