[__git] fix group explorer

group name from numberic id wasn't resolved correctly.

try to use getent and fallback to reading /etc/group directly.
This commit is contained in:
ander 2021-04-28 13:32:10 +03:00
parent 3a25b80466
commit 503a06ed28
No known key found for this signature in database
GPG Key ID: 0A2971E562D618F3
1 changed files with 6 additions and 1 deletions

View File

@ -14,6 +14,11 @@ then
then
printf '%u\n' "${group_gid}"
else
printf '%s\n' "$(id -u -n "${group_gid}")"
if command -v getent > /dev/null
then
getent group "${group_gid}" | cut -d : -f 1
else
awk -F: -v gid="${group_gid}" '$3 == gid { print $1 }' /etc/group
fi
fi
fi