#!/usr/bin/perl -T -I/h/COE/lib -w use strict; use Coe; my $VERSION="1.1.4.1"; if (@ARGV != 4) { &useage; } sub useage { print "Useage: $0 [-g gid] [-n groupname] \n"; exit 1; } my $arg1; my $flag="false"; my $gid="dummy"; my $name="dummy"; while (@ARGV > 0 ){ $arg1=cleanString(shift,1); if ("$arg1" eq "-h") { print "HELP\n"; exit; } elsif ("$arg1" eq "--help") { print "HELP\n"; exit; } elsif ("$arg1" eq "-H") { print "HELP\n"; exit; } elsif ("$arg1" eq "-V") { print "VERSION: $VERSION\n"; exit; } elsif ("$arg1" eq "--version") { print "VERSION: $VERSION\n"; exit; } elsif ("$arg1" eq "-g") { $gid=cleanString(shift,1); } elsif ("$arg1" eq "--group") { $gid=cleanString(shift,1); } elsif ("$arg1" eq "-n") { $name=cleanString(shift,1); } elsif ("$arg1" eq "--name") { $name=cleanString(shift,1); } } # --+----|----+----|----+----|----+----|----+----|----+----|----+----|----+----| # do simple sanity checks # --+----|----+----|----+----|----+----|----+----|----+----|----+----|----+----| if ("$gid" eq "dummy" || "$name" eq "dummy") { &useage; exit 1; } # --+----|----+----|----+----|----+----|----+----|----+----|----+----|----+----| # define some stuff # --+----|----+----|----+----|----+----|----+----|----+----|----+----|----+----| coeRun("/usr/bin/sudo", "/usr/sbin/groupadd", "-g", "$gid", "$name"); |