From 026a944771d82fe7a27f049d7b793ff4008c7cd6 Mon Sep 17 00:00:00 2001 From: Brian Onn Date: Tue, 20 Feb 2024 00:37:40 -0800 Subject: [PATCH] Remove 'egrep' and use 'grep -E' instead. The command 'egrep' (and 'fgrep') has been deprecated since 2007. GNU egrep 3.8+ now prints a warning that 'egrep' is deprecated and this warning appears in the gvm command output. It has been over 16 years since 'egrep' and 'fgrep' were deprecated and it's time to stop using them. Furthermore, POSIX does not even include an 'egrep' or 'fgrep' command, only 'grep'. --- scripts/function/gvm_export_path | 2 +- scripts/function/tools | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/function/gvm_export_path b/scripts/function/gvm_export_path index ec26de19..b1308de8 100644 --- a/scripts/function/gvm_export_path +++ b/scripts/function/gvm_export_path @@ -1,6 +1,6 @@ #!/usr/bin/env bash function gvm_export_path() { - export PATH="$GVM_ROOT/bin:$(echo "$PATH" | $TR_PATH ":" "\n" | "$GREP_PATH" -v '^$' | $EGREP_PATH -v "$GVM_ROOT/(pkgsets|gos|bin)" | $TR_PATH "\n" ":" | $SED_PATH 's/:*$//')" + export PATH="$GVM_ROOT/bin:$(echo "$PATH" | $TR_PATH ":" "\n" | "$GREP_PATH" -v '^$' | $GREP_PATH -E -v "$GVM_ROOT/(pkgsets|gos|bin)" | $TR_PATH "\n" ":" | $SED_PATH 's/:*$//')" export GVM_PATH_BACKUP="$PATH" } diff --git a/scripts/function/tools b/scripts/function/tools index 33ae99db..f71d2c28 100644 --- a/scripts/function/tools +++ b/scripts/function/tools @@ -3,7 +3,6 @@ LS_ERROR="GVM couldn't find ls" TR_ERROR="GVM couldn't find tr" SED_ERROR="GVM couldn't find sed" GREP_ERROR="GVM couldn't find grep" -EGREP_ERROR="GVM couldn't find egrep" SORT_ERROR="GVM couldn't find sort" HEAD_ERROR="GVM couldn't find head" HEXDUMP_ERROR="GVM couldn't find hexdump" @@ -12,7 +11,6 @@ LS_PATH=$(unalias ls &> /dev/null; command -v ls) || display_error "$LS_ERROR" | TR_PATH=$(unalias tr &> /dev/null; command -v tr) || display_error "$TR_ERROR" || return 1 SED_PATH=$(unalias sed &> /dev/null; command -v sed) || display_error "$SED_ERROR" || return 1 GREP_PATH=$(unalias grep &> /dev/null; command -v grep) || display_error "$GREP_ERROR" || return 1 -EGREP_PATH=$(unalias egrep &> /dev/null; command -v egrep) || display_error "$EGREP_ERROR" || return 1 SORT_PATH=$(unalias sort &> /dev/null; command -v sort) || display_error "$SORT_ERROR" || return 1 HEAD_PATH=$(unalias head &> /dev/null; command -v head) || display_error "$HEAD_ERROR" || return 1 HEXDUMP_PATH=$(unalias hexdump &> /dev/null; command -v hexdump) || display_error "$HEXDUMP_ERROR" || return 1