Skip to content

Instantly share code, notes, and snippets.

@scicco
Created November 23, 2012 13:04
Show Gist options
  • Save scicco/4135531 to your computer and use it in GitHub Desktop.
Save scicco/4135531 to your computer and use it in GitHub Desktop.
List all users for each group with members command
#!/bin/bash
# Version: 0.1
# Description: This script has a dependancy with members package
# Tested only on Ubuntu
#
# todo:
# - test members package existance with which output
# - get rid of members dependancy
if [ -x /usr/bin/members ]; then
for GROUP_NAME in `groups`
do
echo "Group: $GROUP_NAME"
echo "Users found: `members $GROUP_NAME`"
done
else
echo "/usr/bin/members not found"
echo "please install members package with: sudo apt-get install members"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment