Open System Services Shell and Utilities Reference Manual (G06.25+, H06.03+)

User Commands (m - o) newgrp(1)
NAME
newgrp - Changes the shell process to a new group
SYNOPSIS
newgrp [-][group]
FLAGS
- Changes the login environment as well as the primary group identication.
DESCRIPTION
The newgrp command changes the primary group identication of the current shell process to
group. Both the users real group ID and effective group ID are changed. Any active user-
generated shell is terminated.
The user remains logged in and the current directory is unchanged. Execution of the newgrp
command always replaces the current shell with a new shell, even when the command terminates
with an error (such as unknown group).
The program used as the new shell is chosen as follows:
1. The program le specied in the security database as the INITIAL-PROGRAM attribute
of the user ID is run.
2. If the INITIAL-PROGRAM attribute is not specied, the program le specied as the
most recently exported value for the SHELL environment variable is run.
If you specify a - (dash), newgrp also changes the login environment of the new shell process to
the login environment of the new group.
Operands
group Species the group name of the group to which the primary group identication
of the shell should be changed.
If you do not specify a group, newgrp changes the primary group identication
to the default group specied for the current user in the system security database.
Only a user with appropriate privileges can change the primary group
identication of the shell to a group to which that user does not belong.
Environment Variables
This command supports the use of the LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
NLSPATH, and SHELL environment variables.
EXIT VALUES
When the newgrp command successfully creates a new shell execution environment, it returns
the exit value of the old shell execution environment. This exit value does not necessarily indi-
cate that the primary group identication was successfully changed.
When the newgrp command fails, it returns the following values:
>0 An error occurred.
RELATED INFORMATION
Commands: sh(1).
STANDARDS CONFORMANCE
This command conforms to the obsolescent alternative within the XPG4 Version 2 specication.
The -l ag is not supported.
527188-003 Hewlett-Packard Company 635