这断代码是我们公司用于服务器体检的一个脚本,现在很多地方不是很懂,希望哪位大侠能帮我读读,感激不敬。本人不是很清楚是不是用shall编程写出来的,有些命令没有见过,完成版请看附件...
echo "Remarks:"
echo " 1. These exemption not allow for members of system and security groups"
echo " system: \c"
lsgroup system | awk '{print $4}'
echo " secruity: \c"
lsgroup security | awk '{print $4}'
echo
echo " 2. List of user id with UID=0 or OSRs"
echo
for x in `lsuser -a ALL`
do
echo " \c"
id $x | awk '$1 ~ /^uid=0\(/ {print $1}' | grep -c "uid=0" | read i
if [[ $i -eq 1 ]]
then
echo "$x \c"
else
### OSR Group
id $x | awk '{print $2" "$3}'| egrep -c "\(system\)|\(security\)|\(bin\)|\(sys\)|\(adm\)|\(uucp\)|\(mail\)|\(printq\)|\(cron\)|\(audit\)|\(shutdown\)|\(ecs\)|\(imnadm\)|\(ipsec\)|\(ldap\)|\(lp\)|\(haemrm\)|\(snapp\)|\(hacmp\)" | read i
if [[ $i -eq 1 ]]
then
echo "$x \c"
fi
fi
done
echo
echo


comes 于 2011-04-05 17:01:46发表:
收藏了。谢谢分享。。。