From a513e139c09cbc3aaef1cd67d7d9581fb49b7c49 Mon Sep 17 00:00:00 2001 From: Gurkirat Singh Date: Fri, 7 Oct 2022 19:51:34 +0530 Subject: [PATCH] fix (core): use grep -E instead of egrep --- lib/utilities.bash | 4 ++-- plugins/available/aws.plugin.bash | 6 +++--- themes/rjorgenson/rjorgenson.theme.bash | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/utilities.bash b/lib/utilities.bash index 6d5fd5d4..5bd6ab26 100644 --- a/lib/utilities.bash +++ b/lib/utilities.bash @@ -62,13 +62,13 @@ function _bash-it-array-dedup() { # Outputs a full path of the grep found on the filesystem function _bash-it-grep() { - : "${BASH_IT_GREP:=$(type -P egrep || type -P grep)}" + : "${BASH_IT_GREP:=$(type -P grep)}" printf "%s" "${BASH_IT_GREP:-/usr/bin/grep}" } # Runs `grep` with extended regular expressions function _bash-it-egrep() { - : "${BASH_IT_GREP:=$(type -P egrep || type -P grep)}" + : "${BASH_IT_GREP:=$(type -P grep)}" "${BASH_IT_GREP:-/usr/bin/grep}" -E "$@" } diff --git a/plugins/available/aws.plugin.bash b/plugins/available/aws.plugin.bash index 54a86691..01f00d15 100644 --- a/plugins/available/aws.plugin.bash +++ b/plugins/available/aws.plugin.bash @@ -40,13 +40,13 @@ function __awskeys_help { function __awskeys_get { local ln=$(grep -n "\[ *$1 *\]" "${AWS_SHARED_CREDENTIALS_FILE}" | cut -d ":" -f 1) if [[ -n "${ln}" ]]; then - tail -n +${ln} "${AWS_SHARED_CREDENTIALS_FILE}" | egrep -m 2 "aws_access_key_id|aws_secret_access_key" - tail -n +${ln} "${AWS_SHARED_CREDENTIALS_FILE}" | egrep -m 1 "aws_session_token" + tail -n +${ln} "${AWS_SHARED_CREDENTIALS_FILE}" | grep -E -m 2 "aws_access_key_id|aws_secret_access_key" + tail -n +${ln} "${AWS_SHARED_CREDENTIALS_FILE}" | grep -E -m 1 "aws_session_token" fi } function __awskeys_list { - local credentials_list="$((egrep '^\[ *[a-zA-Z0-9_-]+ *\]$' "${AWS_SHARED_CREDENTIALS_FILE}"; grep "\[profile" "${AWS_CONFIG_FILE}" | sed "s|\[profile |\[|g") | sort | uniq)" + local credentials_list="$((grep -E '^\[ *[a-zA-Z0-9_-]+ *\]$' "${AWS_SHARED_CREDENTIALS_FILE}"; grep "\[profile" "${AWS_CONFIG_FILE}" | sed "s|\[profile |\[|g") | sort | uniq)" if [[ -n $"{credentials_list}" ]]; then echo -e "Available credentials profiles:\n" for profile in ${credentials_list}; do diff --git a/themes/rjorgenson/rjorgenson.theme.bash b/themes/rjorgenson/rjorgenson.theme.bash index 71d29e78..e7f3a78e 100644 --- a/themes/rjorgenson/rjorgenson.theme.bash +++ b/themes/rjorgenson/rjorgenson.theme.bash @@ -50,7 +50,7 @@ function is_integer() { # helper function for todo-txt-count todo_txt_count() { if `hash todo.sh 2>&-`; then # is todo.sh installed - count=`todo.sh ls | egrep "TODO: [0-9]+ of ([0-9]+) tasks shown" | awk '{ print $4 }'` + count=`todo.sh ls | grep -E "TODO: [0-9]+ of ([0-9]+) tasks shown" | awk '{ print $4 }'` if is_integer $count; then # did we get a sane answer back echo "${BRACKET_COLOR}[${STRING_COLOR}T:$count${BRACKET_COLOR}]$normal" fi