EnderUNIX Team.


EnderUNIX tips

Mail to My Friend , Home Page

[ UNIX ]

"The next UID" - Ülkü SAYILAN - (2004-06-19 17:14:10)   [6600]

The next UID

Here is one way to find out the next available UID on a system.

It takes both the password and group files and finds the next available UID and displays it.

(No cats were harmed in the making of this script)

#!/bin/bash
awk -F":" '{ print $3 }' /etc/passwd > number_list
awk -F":" '{ print $3 }' /etc/group >> number_list
A=` sort -g number_list | tail -1`
A=`expr $A + 1`
echo "New Available UID is $A"

Mail to My Friend , Home Page