fix (core): use grep -E instead of egrep

pull/2168/head
Gurkirat Singh 2022-10-07 19:51:34 +05:30
parent 74d53fba16
commit a513e139c0
No known key found for this signature in database
GPG Key ID: BD8D9949734FDB24
3 changed files with 6 additions and 6 deletions

View File

@ -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 "$@"
}

View File

@ -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

View File

@ -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