because newgrp spawns a new shell, you can't just "newgrp <group>" or it will do that infinitely. use a conditional, e.g.: [ $(id -gn) = svn ] || exec newgrp svn