Skip to content

Instantly share code, notes, and snippets.

@hackingbutlegal
Created February 12, 2013 03:42
Show Gist options
  • Save hackingbutlegal/4760089 to your computer and use it in GitHub Desktop.
Save hackingbutlegal/4760089 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# List the group(s) associated with each user defined in /etc/passwd
#
#
###########################################
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment