Files
mastering-unix-ss/chapter6/search_group_id.bash
Fabio Scotto di Santolo 4cc88d2f6e initial commit
2020-07-28 19:28:25 +02:00

29 lines
602 B
Bash
Executable File

#!/bin/bash
#
# SCRIPT: search_group_id.bash
# AUTHOR: Randy Michael
# DATE: 14/4/2007
# REV: 1.0
# PURPOSE: This script is used to list the group(s) associated
# with each user defined in the /etc/passwd file.
#
#
###########################################
# DECLARE FILES AND VARIABLES HERE
###########################################
case $(uname) in
SunOS) alias awk=nawk
;;
esac
#########################################
# BEGINNING OF MAIN
#########################################
cat /etc/passwd | awk -F : '{print $1}' | while read ID
do
echo -e "${ID}: \c"
id -Gn $ID
done