projects
/
usertools.macosx.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b052645
)
Simplify detection of next usable user ID
author
Alexander Barton
<alex@barton.de>
Mon, 28 Sep 2009 10:17:47 +0000
(12:17 +0200)
committer
Alexander Barton
<alex@barton.de>
Mon, 28 Sep 2009 10:17:47 +0000
(12:17 +0200)
Thanks to phrank!
useradd.macosx.sh
patch
|
blob
|
history
diff --git
a/useradd.macosx.sh
b/useradd.macosx.sh
index 5382ec02d84baf49073751a179f392b936e0971e..252ff941b619913926e38b12a20028966b623692 100755
(executable)
--- a/
useradd.macosx.sh
+++ b/
useradd.macosx.sh
@@
-128,13
+128,8
@@
fi
# No user ID given, generate it
if [ $user_id -lt 0 ]; then
# search next free user ID
- declare -i new_id=501
- id "$new_id" >/dev/null 2>&1
- while [ $? -eq 0 ]; do
- new_id=$new_id+1;
- id "$new_id" >/dev/null 2>&1
- done
- user_id=$new_id
+ user_id=`echo $[$(dscl . -list /Users uid | awk '{print $2}' \
+ | sort -n | tail -n1)+1]`
fi
# Validate user name, user id and group id