From 316c9f34c6f0f229b93cac44de5ac08416e6abc7 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Mon, 20 Mar 2017 04:50:32 +0800 Subject: [PATCH] [Performance] Use awk's comparison to save a pipe to grep --- nvm.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nvm.sh b/nvm.sh index 65fd9d7..0d9eb02 100644 --- a/nvm.sh +++ b/nvm.sh @@ -1181,9 +1181,7 @@ nvm_get_checksum() { SHASUMS_URL="${MIRROR}/${3}/SHASUMS.txt" fi - nvm_download -L -s "${SHASUMS_URL}" -o - | \ - nvm_grep "${4}.tar.${5}" | \ - command awk '{print $1}' + nvm_download -L -s "${SHASUMS_URL}" -o - | command awk "{ if (\"${4}.tar.${5}\" == \$2) print \$1}" } nvm_checksum() {