Getting bash of newgrp functions at startup

As part of my settings, I often need, in our environements, to use

newgrp voodoo

If I try to put it in a file .bashrc, I get endless loops.

Any ideas on how to get the same functionality that loads automatically at startup?

+5
source share
1 answer

There are two scenarios that will start after bash starts:

  • .bashrc for interactive shells

  • .bash_profile for entry shells

Depending on how you run the command newgrp, one of them will be executed:

  • newgrp - your_group will launch a new login shell and thus read .bash_profile

  • newgrp your_group( no dash) will launch a new interactive shell reading.bashrc

, , script newgrp switch

  • newgrp - ... .bashrc

  • newgrp ... .bash_profile

. , , .

BTW.: if .bash_profile bash .profile. , .bashrc .

, , , . $GROUPS , , :

[ "$GROUPS" = "200" ] || newgrp your_group

- .

+6

All Articles