is_root_owned

This commit is contained in:
2025-08-08 12:22:47 -05:00
parent da533a8a09
commit 0584974538
2 changed files with 26 additions and 0 deletions

View File

@@ -66,6 +66,21 @@ echo_if_fail() {
return ${retval}
}
is_root_owned() {
local path=$1
local uid
if stat --version >/dev/null 2>&1; then
# GNU coreutils (Linux)
uid=$(stat -c '%u' "$path")
else
# BSD/macOS
uid=$(stat -f '%u' "$path")
fi
test "$uid" -eq 0
}
dump_arr() {
arr_name="$1"
declare -n arr