Commit d5d079f2 authored by Vitaly Lipatov's avatar Vitaly Lipatov

tools_json: replace egrep with grep -E

parent ba7a55a9
...@@ -77,14 +77,14 @@ tokenize () { ...@@ -77,14 +77,14 @@ tokenize () {
local ESCAPE local ESCAPE
local CHAR local CHAR
if echo "test string" | egrep -ao --color=never "test" >/dev/null 2>&1 if echo "test string" | grep -E -ao --color=never "test" >/dev/null 2>&1
then then
GREP='egrep -ao --color=never' GREP='grep -E -ao --color=never'
else else
GREP='egrep -ao' GREP='grep -E -ao'
fi fi
if echo "test string" | egrep -o "test" >/dev/null 2>&1 if echo "test string" | grep -E -o "test" >/dev/null 2>&1
then then
ESCAPE='(\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})' ESCAPE='(\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})'
CHAR='[^[:cntrl:]"\\]' CHAR='[^[:cntrl:]"\\]'
...@@ -102,7 +102,7 @@ tokenize () { ...@@ -102,7 +102,7 @@ tokenize () {
# Force zsh to expand $A into multiple words # Force zsh to expand $A into multiple words
local is_wordsplit_disabled=$(unsetopt 2>/dev/null | grep -c '^shwordsplit$') local is_wordsplit_disabled=$(unsetopt 2>/dev/null | grep -c '^shwordsplit$')
if [ $is_wordsplit_disabled != 0 ]; then setopt shwordsplit; fi if [ $is_wordsplit_disabled != 0 ]; then setopt shwordsplit; fi
$GREP "$STRING|$NUMBER|$KEYWORD|$SPACE|." | egrep -v "^$SPACE$" $GREP "$STRING|$NUMBER|$KEYWORD|$SPACE|." | grep -E -v "^$SPACE$"
if [ $is_wordsplit_disabled != 0 ]; then unsetopt shwordsplit; fi if [ $is_wordsplit_disabled != 0 ]; then unsetopt shwordsplit; fi
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment