git: 67f28803e0ec - stable/15 - newgrp.1: Provide examples

From: Alexander Ziaee <ziaee_at_FreeBSD.org>
Date: Fri, 10 Apr 2026 18:31:13 UTC
The branch stable/15 has been updated by ziaee:

URL: https://cgit.FreeBSD.org/src/commit/?id=67f28803e0ec3ec93cb431bb6c0b3680a91d0849

commit 67f28803e0ec3ec93cb431bb6c0b3680a91d0849
Author:     Felix Johnson <fjohnson@felix-johnson.com>
AuthorDate: 2026-02-27 00:45:03 +0000
Commit:     Alexander Ziaee <ziaee@FreeBSD.org>
CommitDate: 2026-04-10 18:28:36 +0000

    newgrp.1: Provide examples
    
    "These examples appear to be originally noted thirteen years ago by
    Mark Saad, contributed by eadler, put into a patch by Felix Johnson,
    and made into mdoc by myself. Finally, put this bug to rest." ~ziaee
    
    PR:                     167742
    Co-authored-by:         eadler, ziaee, Mark Saad
    Differential Revision:  https://reviews.freebsd.org/D48877
    
    (cherry picked from commit 86dc5dd0b2a861cf9d8cad18fc17c17dbbfc4465)
---
 usr.bin/newgrp/newgrp.1 | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/usr.bin/newgrp/newgrp.1 b/usr.bin/newgrp/newgrp.1
index d9701feef0d7..032aeb72616d 100644
--- a/usr.bin/newgrp/newgrp.1
+++ b/usr.bin/newgrp/newgrp.1
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd February 8, 2013
+.Dd February 6, 2025
 .Dt NEWGRP 1
 .Os
 .Sh NAME
@@ -67,6 +67,21 @@ exits >0.
 Otherwise, the exit status of
 .Nm
 is the exit status of the shell.
+.Sh EXAMPLES
+Create a new group,
+.Ar foo ,
+with
+.Xr pw 8 :
+.Pp
+.Dl pw group add foo
+.Pp
+Set the group password:
+.Pp
+.Dl pw group mod foo -h 0
+.Pp
+As a non-root user, switch to the group:
+.Pp
+.Dl newgrp foo
 .Sh SEE ALSO
 .Xr csh 1 ,
 .Xr groups 1 ,