updated to properly handle being in or out of correct groups.
fixed typeo when checking for lines in shell file