|
|
Exported variables retain their values after invoking newgrp; however, all unexported variables are either reset to their default value or set to null. Environment variables (such as PS1, PS2, PATH, MAIL, and HOME), unless exported by the system or explicitly exported by the user, are reset to default values. For example, a user has a primary prompt string (PS1) other than ``$'' (default) and has not exported PS1. After an invocation of newgrp, successful or not, the user's PS1 will now be set to the default prompt string ``$''. The shell command export (see the sh(1) manual page) should be used to export variables so that they retain their assigned value when new shells are invoked.
With no arguments, newgrp changes the user's group IDs (real and effective) back to the group specified in the user's password file entry. This is a way to undo the effect of an earlier newgrp command.
If the first argument to newgrp is a - or -l, the environment is changed to what would be expected if the user logged in again as a member of the new group.