[Fix] `debug`: `awk`: not an option: `--version`

On Debian, the default awk/mawk doesn't support the '--version' option;
instead there's mawk-specific '-W version'.
ryenus 2022-10-21 16:48:00 +08:00 committed by Jordan Harband
parent 9721791563
commit 095a4ca655
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56
1 changed files with 7 additions and 1 deletions

8
nvm.sh
View File

@ -2996,6 +2996,12 @@ nvm() {
if [ -n "${OS_VERSION}" ]; then
nvm_err "OS version: ${OS_VERSION}"
fi
if nvm_has "awk"; then
nvm_err "awk: $(nvm_command_info awk), $({ command awk -V 2>/dev/null || command awk -W version; } \
| command head -n 1)"
else
nvm_err "awk: not found"
fi
if nvm_has "curl"; then
nvm_err "curl: $(nvm_command_info curl), $(command curl -V | command head -n 1)"
else
@ -3008,7 +3014,7 @@ nvm() {
fi
local TEST_TOOLS ADD_TEST_TOOLS
TEST_TOOLS="git grep awk"
TEST_TOOLS="git grep"
ADD_TEST_TOOLS="sed cut basename rm mkdir xargs"
if [ "darwin" != "$(nvm_get_os)" ] && [ "freebsd" != "$(nvm_get_os)" ]; then
TEST_TOOLS="${TEST_TOOLS} ${ADD_TEST_TOOLS}"