Ok, I apologize. I didn't realize how new the option was (it was commited in
February. It is in 7.0-STABLE, however, which is what I am using.
As a cop out I made this script to remove a specified user from a specified group:
Code:
#!/bin/sh
# Remove a user from a group
# Usage: groupmod.sh <groupname> <username>
# Use only one group and one user at a time...multiple users could be done from another script
GROUP=$1
USER=$2
PW=/usr/sbin/pw
SED=/usr/bin/sed
if [ -z "$1" ]
then
echo "Oops! You forgot to specify the Group."
exit 1
fi
if [ -z "$2" ]
then
echo "Oops! You forgot to specify the Username."
exit 1
fi
# Show existing users in the group and use sed to remove them from the list
NEWMEMBERS=`${PW} groupshow ${GROUP} -P | ${SED} -e '1d' -e 's|^[ \t]*||' -e 's|Members: ||' -e "s|${USER}||g" -e 's|,$||'`
# Feed pw the list of users that were in the group minus the deleted user
${PW} groupmod ${GROUP} -M ${NEWMEMBERS}