The test op/groups checks for groups in /usr/bin and /usr/ucb.
This fails on some Linux distributions that has groups in /bin.
A better test would be to just run groups (take whatever is in the
path) and see if it outputs a list that includes the current
group. Possibly you could prepend /bin:/usr/bin:/usr/ucb to the
current path. Something like this.
p5p-msgid:
199705191120.NAA08130@ostrich.gaia.swipnet.se
#!./perl
-if (! -x ($groups = '/usr/ucb/groups') && ! -x ($groups = '/usr/bin/groups')) {
+$ENV{'PATH'} = "/bin:/usr/ucb:/usr/bin:$ENV{'PATH'}";
+
+$curgrp = (getgrgid($())[0];
+foreach (split(/\s+/, `groups 2>/dev/null`)) {
+ $ok++, last if $_ eq $curgrp;
+}
+
+if (! $ok) {
print "1..0\n";
exit 0;
}
$gr1 = join(' ', sort @gr);
-$gr2 = join(' ', grep(!$basegroup{$_}++, sort split(' ',`$groups`)));
+$gr2 = join(' ', grep(!$basegroup{$_}++, sort split(' ',`groups`)));
if ($gr1 eq $gr2) {
print "ok 1\n";