[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Adding and removing a user automatically



Hi,

	Let us see if I can code this directly in here. BTW, perl does
 not need a dependency if you can do with things in perl-base.

	manoj
 partially tested code.
______________________________________________________________________
 #!/bin/bash
 user="$1"
 gid="$2"

 mgroup=$(egrep "^$user:" /etc/passwd |  | cut -d: -f 4 )
 groups=$(egrep "$user" /etc/group  | cut -d: -f 3)

 for group in $mgroup $groups; do
    if [ "X$group" = "X$gid" ]; then
        echo "Found user $user with gid $gid"
        exit 0
    fi
 done
 echo "Not found $user"

-- 
 Productivity = (Number of secretaries X Average typing speed) /
 (Number of Scientists).  Note that when the number of scientists is
 zero, productivity becomes infinite.  -- Robert Sommer
Manoj Srivastava  <srivasta@acm.org> <http://www.datasync.com/%7Esrivasta/>
Key C7261095 fingerprint = CB D9 F4 12 68 07 E4 05  CC 2D 27 12 1D F5 E8 6E


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: