From 18e638e42b7df5a5097c6e751514d37b1d56ca33 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Fri, 5 Sep 2025 09:37:06 -0700 Subject: [PATCH] [Fix] `sh` lacks `-O`; thanks shellcheck --- nvm.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nvm.sh b/nvm.sh index d943896..01013b8 100755 --- a/nvm.sh +++ b/nvm.sh @@ -2985,7 +2985,8 @@ nvm_check_file_permissions() { if [ ! -L "${FILE}" ] && ! nvm_check_file_permissions "${FILE}"; then return 2 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")" return 1 fi