diff options
-rwxr-xr-x | localadduser | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/localadduser b/localadduser index 398e080..e3cd3a1 100755 --- a/localadduser +++ b/localadduser @@ -37,6 +37,9 @@ for chunk in $@; do @*) groupchunks="${groupchunks:+$groupchunks }$chunk" ;; + %*) + officechunks="${officechunks:+$officechunks }$chunk" + ;; *@*) other="${other:+$other }$chunk" ;; @@ -80,11 +83,15 @@ for groupchunk in $groupchunks; do groups="${groups:+$groups }$group" done +for officechunk in $officechunks; do + office="${office:+$office }$(echo "$officechunk" | perl -pe 's/^%//;')" +done + if [ ! "$interactive" -gt 0 ]; then quiet="--quiet" fi -if [ -n "$fullname$office_phone$home_phone$other" ]; then - eval $simulate sudo "/usr/sbin/adduser $quiet --disabled-login --gecos \"$fullname,,$office_phone,$home_phone,$other\" \"$u\"" +if [ -n "$fullname$office$office_phone$home_phone$other" ]; then + eval $simulate sudo "/usr/sbin/adduser $quiet --disabled-login --gecos \"$fullname,$office,$office_phone,$home_phone,$other\" \"$u\"" else if [ ! "$interactive" -gt 0 ]; then exit1 "Not enough info provided to create account for \"$u\"!" |