Get effective group id

Pieter de Goeje pieter at degoeje.nl
Tue Aug 21 02:28:32 PDT 2007


On Tuesday 21 August 2007, Olivier Nicole wrote:
> Hi,
>
> >From a Bourne shell script, how to get (and test) the group id of the
>
> user that is executing the script?
>
> Best regards,
>
> Olivier
id -g will get you the egid. 

if [ `id -g` -eq 1001 ]; then
        echo "It's a hit!"
fi

Hope this helps,

Pieter de Goeje


More information about the freebsd-questions mailing list