Fix a bunch of little things from the previous changeset.
[pkgusr] / usr / lib / pkgusr / chown
index f48828a..933c415 100755 (executable)
@@ -51,15 +51,24 @@ grp=${usrgrp/*[.:]/}
 report=0
 
 # Catch the case where USER is somebody else.
 report=0
 
 # Catch the case where USER is somebody else.
-if [[ -n "$usr" && ("$usr" != "$(id -un)" ||
-               ($usr -ge 0 && $usr -ne $(id -u))) ]]; then
-    report=1
+if [ -n "$usr" ]; then
+    printf '%d' $usr &>/dev/null
+    if [ $? -eq 0 ]; then
+       if [ $usr -ne $(id -u) ]; then
+           report=1
+       fi
+    else
+       if [ "$usr" != "$(id -un)" ]; then
+           report=1
+       fi
+    fi
 fi
 
 # Catch the case where GROUP isn't in our groups.
 if [ -n "$grp" -a $report -eq 0 ]; then
     GRP_CHAIN=""
 fi
 
 # Catch the case where GROUP isn't in our groups.
 if [ -n "$grp" -a $report -eq 0 ]; then
     GRP_CHAIN=""
-    if [ $grp -ge 0 2>/dev/null ]; then
+    printf '%d' $grp &>/dev/null
+    if [ $? -eq 0 ]; then
        GRP_LIST=$(id -G)
     else
        GRP_LIST=$(id -Gn)
        GRP_LIST=$(id -G)
     else
        GRP_LIST=$(id -Gn)
@@ -77,9 +86,9 @@ if [ -n "$grp" -a $report -eq 0 ]; then
 fi
 
 if [ $report -eq 1 ]; then
 fi
 
 if [ $report -eq 1 ]; then
-    echo 1>&2 '***' chown "$cmdline"  
+    echo 1>&2 '***' chown ${cmdline}
 else
 else
-    exec $DAISY_CHAIN "$cmdline" || exit $?
+    exec $DAISY_CHAIN ${cmdline} || exit $?
 fi
 
 exit 0
 fi
 
 exit 0