mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-02-05 09:22:50 +08:00
[Fix] nvm_get_default_packages: use portable awk patterns
Replace POSIX `[[:space:]]` character class with `[ \t]` for mawk compatibility on Ubuntu 16.04.
This commit is contained in:
6
nvm.sh
6
nvm.sh
@@ -4530,9 +4530,9 @@ nvm_get_default_packages() {
|
||||
NVM_DEFAULT_PACKAGE_FILE="${NVM_DIR}/default-packages"
|
||||
if [ -f "${NVM_DEFAULT_PACKAGE_FILE}" ]; then
|
||||
command awk -v filename="${NVM_DEFAULT_PACKAGE_FILE}" '
|
||||
/^[[:space:]]*#/ { next } # Skip lines that begin with #
|
||||
/^[[:space:]]*$/ { next } # Skip empty lines
|
||||
/[[:space:]]/ && !/^[[:space:]]*#/ {
|
||||
/^[ \t]*#/ { next } # Skip lines that begin with #
|
||||
/^[ \t]*$/ { next } # Skip empty lines
|
||||
/[ \t]/ && !/^[ \t]*#/ {
|
||||
print "Only one package per line is allowed in `" filename "`. Please remove any lines with multiple space-separated values." > "/dev/stderr"
|
||||
err = 1
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user