#!/bin/ksh
for LOOP in $(cat /etc/passwd|cut -f1,4 -d':')
do
USRNAM=$(echo ${LOOP} |cut -f1 -d':')
GRPID=$(echo ${LOOP} |cut -f2 -d':')
GRPNAM=$(cat /etc/group |grep ":${GRPID}:"|cut -f1 -d':')
echo "User \"${USRNAM}\" belongs to \"${GRPNAM}\" group"
done
for LOOP in $(cat /etc/passwd|cut -f1,4 -d':')
do
USRNAM=$(echo ${LOOP} |cut -f1 -d':')
GRPID=$(echo ${LOOP} |cut -f2 -d':')
GRPNAM=$(cat /etc/group |grep ":${GRPID}:"|cut -f1 -d':')
echo "User \"${USRNAM}\" belongs to \"${GRPNAM}\" group"
done
No comments:
Post a Comment