From 972179156316e0cd6c9383f3bbbd379edd024935 Mon Sep 17 00:00:00 2001 From: ryenus Date: Thu, 20 Oct 2022 10:49:43 +0800 Subject: [PATCH] [Fix] grep: warning: stray \ before / No need to escape the `/` char in a grep pattern. This is to fix the below error when using newer grep with `nvm_command_info` > $ nvm_command_info curl > grep: warning: stray \ before / > /usr/bin/curl This happens with at least GNU grep 3.8 version. --- nvm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvm.sh b/nvm.sh index c26d84d..1a72fa1 100644 --- a/nvm.sh +++ b/nvm.sh @@ -70,7 +70,7 @@ nvm_command_info() { elif type "${COMMAND}" | nvm_grep -q "^${COMMAND} is an alias for"; then # shellcheck disable=SC2230 INFO="$(which "${COMMAND}") ($(type "${COMMAND}" | command awk '{ $1=$2=$3=$4=$5="" ;print }' | command sed 's/^\ *//g'))" - elif type "${COMMAND}" | nvm_grep -q "^${COMMAND} is \\/"; then + elif type "${COMMAND}" | nvm_grep -q "^${COMMAND} is /"; then INFO="$(type "${COMMAND}" | command awk '{print $3}')" else INFO="$(type "${COMMAND}")"