[Fix] sh lacks -O; thanks shellcheck

This commit is contained in:
Jordan Harband 2025-09-05 09:37:06 -07:00
parent 9602f4f959
commit 18e638e42b
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56

3
nvm.sh
View File

@ -2985,7 +2985,8 @@ nvm_check_file_permissions() {
if [ ! -L "${FILE}" ] && ! nvm_check_file_permissions "${FILE}"; then if [ ! -L "${FILE}" ] && ! nvm_check_file_permissions "${FILE}"; then
return 2 return 2
fi fi
elif [ -e "$FILE" ] && [ ! -w "$FILE" ] && [ ! -O "$FILE" ]; then elif [ -e "$FILE" ] && [ ! -w "$FILE" ] && [ -z "$(command find "${FILE}" -prune -user "$(command id -u)")" ]; then
# ^ file ownership check from https://www.shellcheck.net/wiki/SC3067
nvm_err "file is not writable or self-owned: $(nvm_sanitize_path "$FILE")" nvm_err "file is not writable or self-owned: $(nvm_sanitize_path "$FILE")"
return 1 return 1
fi fi