20 lines
414 B
Bash
Executable File
20 lines
414 B
Bash
Executable File
#!/bin/sh -e
|
|
|
|
destination="/${__object_id:?}"
|
|
|
|
# shellcheck disable=SC2012
|
|
group_gid=$(ls -ldn "${destination}" | awk '{ print $4 }')
|
|
|
|
# NOTE: +1 because $((notanum)) prints 0.
|
|
if test $((group_gid + 1)) -ge 0
|
|
then
|
|
group_should=$(cat "${__object:?}/parameter/group")
|
|
|
|
if expr "${group_should}" : '[0-9]*$' >/dev/null
|
|
then
|
|
printf '%u\n' "${group_gid}"
|
|
else
|
|
printf '%s\n' "$(id -u -n "${group_gid}")"
|
|
fi
|
|
fi
|