Sylvain masnada wrote: > > Hi all, Hello,
> I'd like to get a script which allows me to get the gid of the > user which is connected currently. > I've done this "script" which is not very useful for me because > I have to run it like this : > id | myscript.pl You could run id inside your perl program. my $id_output = qx/id/; > My script is : > > while(<>) > { > if(/^uid=\d+.\w+.\sgid=(\d+)/) > { > $gid=$1; > print "gid:$gid\n"; > } > } Perl supplies the User ID in $<, the Effective User ID in $>, the Group ID in $( and the Effective Group ID in $). print "gid: $(\n"; To find the name assigned to $(: my $group = getgrgid $(; print "Group: $group\n"; To get all groups that $( belongs to: my @groups; my $name = getpwuid $<; while ( my @ent = getgrent ) { push @groups, $ent[ 0 ] if $ent[ -1 ] =~ /\b$name\b/; } print "@groups\n" > My aim is to change the ip address following the gid. The id program does not output an ip address. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]