From 07e0c9ce629322e93b1638fa87d9ecce4cb9ada7 Mon Sep 17 00:00:00 2001 From: thib Date: Sat, 10 Aug 2002 20:41:18 +0000 Subject: [PATCH] modified to be able to print the uid (not only the gid) --- script/has_usrgrp.pl | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/script/has_usrgrp.pl b/script/has_usrgrp.pl index c0dfb31..96f0e6e 100755 --- a/script/has_usrgrp.pl +++ b/script/has_usrgrp.pl @@ -5,7 +5,7 @@ # even if NYS (or similar) is used) sub usage { - return "usage:\n has_usrgrp.pl [-user user|-group group] [-printgid]\n"; + return "usage:\n has_usrgrp.pl [-user user|-group group] [-printuid|-printgid]\n"; } if ( @ARGV < 2 || @ARGV > 3) { @@ -22,12 +22,20 @@ else { die usage(); } -if ($name) { - if ( @ARGV == 3 && $ARGV[2] eq "-printgid" ) { +if ( ! $name) { + exit 1; +} + +if ( @ARGV == 3 ) { + if ( $ARGV[2] eq "-printgid" ) { print $gid, "\n"; } - exit 0; -} -else { - exit 1; + elsif ( $ARGV[2] eq "-printuid" ) { + if ( defined $uid ) { + print $uid, "\n"; + } else { + die usage(); + } + } } +exit 0; -- 2.40.0