fix (core): use grep -E instead of egrep
parent
74d53fba16
commit
a513e139c0
|
|
@ -62,13 +62,13 @@ function _bash-it-array-dedup() {
|
||||||
|
|
||||||
# Outputs a full path of the grep found on the filesystem
|
# Outputs a full path of the grep found on the filesystem
|
||||||
function _bash-it-grep() {
|
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}"
|
printf "%s" "${BASH_IT_GREP:-/usr/bin/grep}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Runs `grep` with extended regular expressions
|
# Runs `grep` with extended regular expressions
|
||||||
function _bash-it-egrep() {
|
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 "$@"
|
"${BASH_IT_GREP:-/usr/bin/grep}" -E "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,13 +40,13 @@ function __awskeys_help {
|
||||||
function __awskeys_get {
|
function __awskeys_get {
|
||||||
local ln=$(grep -n "\[ *$1 *\]" "${AWS_SHARED_CREDENTIALS_FILE}" | cut -d ":" -f 1)
|
local ln=$(grep -n "\[ *$1 *\]" "${AWS_SHARED_CREDENTIALS_FILE}" | cut -d ":" -f 1)
|
||||||
if [[ -n "${ln}" ]]; then
|
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}" | grep -E -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 1 "aws_session_token"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function __awskeys_list {
|
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
|
if [[ -n $"{credentials_list}" ]]; then
|
||||||
echo -e "Available credentials profiles:\n"
|
echo -e "Available credentials profiles:\n"
|
||||||
for profile in ${credentials_list}; do
|
for profile in ${credentials_list}; do
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ function is_integer() { # helper function for todo-txt-count
|
||||||
|
|
||||||
todo_txt_count() {
|
todo_txt_count() {
|
||||||
if `hash todo.sh 2>&-`; then # is todo.sh installed
|
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
|
if is_integer $count; then # did we get a sane answer back
|
||||||
echo "${BRACKET_COLOR}[${STRING_COLOR}T:$count${BRACKET_COLOR}]$normal"
|
echo "${BRACKET_COLOR}[${STRING_COLOR}T:$count${BRACKET_COLOR}]$normal"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue