You are so cool, Jeffrey :-) I just made it slightly smarter wanted_group=<string-of-wanted-group> my_current_group=`id -g -n` if [[ $my_current_group != $wanted_group ]]; then #rest-of my bash_profile so it doesn't get executed twice newgrp - $wanted_group fi