i need a script to process a password file and based on the UIDs in the password file, generate the new UID that is 1 greater than the highest uid.
i have some script logic but i dont really understand it. any help?
#!/usr/bin/perl
##########################################
# ITEC 400
# Script name: newuid.pl
# Case Number 1: ./newuid.pl small_passwd
# The small_passwd file is located ~/public_html/itec400/Misc
# The name of the file must be specified on the command line.
# Functionality: The newuid.pl script reads the uids in the small_passwd
# file. The script determines the highest numbers uid currently
# in use, and adds one to it for the next user.
##############################################
for $XXXX(@ARGV) {
$counter++;
}
if ($XXXXXXX != 1) {
print "Error. Need one argument.\n";
}
if ($XXXXXXX == 1) {
$flag = 0;
exec `XXX -f3 -d":" /export/home/dandrear/public_html/itec400/Misc/$XXXX[]> "uidoutput"`;
open (reader, "uidoutput");
while ($line = <XXXXXX>) {
$firsttest = $XXXX;
if ($XXXX == 0) {
$secondtest = $XXXXXXXXX;
} # end if
$flag = 1;
if ($secondtest < $XXXXXXXXX) {
$secondtest = $XXXXXXXXX;
} #end if
} # end while
$newIDNum = $XXXXXXXXXX + 1;
print "The new User ID number is ";
print $XXXXXXXX;
print "\n";
} # end if