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