hello,
the two commands below, gives me one next free uid and second one next free group id on a system (both from range 2000-10000)
I need to find first free number from that range, which is the same for /etc/passwd and /etc/group (to create a user with the same number of his uid and gid where guid are from mentined range).
awk -F: '{uid[$3]=1}END{for(x=2000; x<=10000; x++) {if(uid[x] != ""){}else{print x; exit;}}}' /etc/passwd
awk -F: '{uid[$3]=1}END{for(x=2000; x<=10000; x++) {if(uid[x] != ""){}else{print x; exit;}}}' /etc/group
thx,
kind regards,