But Why do you want the next available uid, If it was for adding a new user I would suggest You use /sbin/useradd command rather than attempting to write into passwd directly. I did this that mistake for one of my projects and find myselyf in a soup many a times
Ram Anidil Rajendran wrote: > Hi Perl Gurus, > > This is a newbie question ofcourse. Since it is not working for me I am asking here. > I am trying to skip UID above 60000. > > $passwd = "/etc/passwd"; > $skip = 60000; > open(PW,$passwd) or die "Can't open $passwd:$!\n"; > while (<PW>){ > @fields = split(/:/); > next if $fields[2] > $skip; > $highestuid = ($highestuid < $fields[2]) ? $fields[2] : $highestuid; > } > close(PW); > print "The next available UID is " . ++$highestuid . "\n"; > > Thanks for any suggestion. > > > Anidil Rajendran > Redwood Shores,CA > 650 730 8271 > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]