Se você exportar PS1
, o valor não deverá ser redefinido. Na página de manual newgrp do Solaris:
Any variable that is not exported is reset to null or its default value. Exported variables retain their values. System variables (such as
PS1
,PS2
,PATH
,HOME
), are reset to default values unless they have been exported by the system or the user. For example, when a user has a primary prompt string (PS1
) other than $ (default) and has not exportedPS1
, the user'sPS1
will be set to the default prompt string $, even if newgrp terminates with an error. Note that the shell command export (seesh
(1) andset
(1)) is the method to export variables so that they retain their assigned value when invoking new shells.
Como alternativa, você pode passar o sinal -
para newgrp
para reinicializar o ambiente como se tivesse acabado de efetuar login.