# HG changeset patch # User Augie Fackler # Date 1668440771 18000 # Node ID b0fa9e7cadac7dff1179382b3ac62714a9aea086 # Parent 24f7a481d284d645fd1f34d76b595001cc512f1c shell: speed things up by golfing out grep diff --git a/.shell.d/00.path_manipulation.sh b/.shell.d/00.path_manipulation.sh --- a/.shell.d/00.path_manipulation.sh +++ b/.shell.d/00.path_manipulation.sh @@ -12,9 +12,9 @@ function insert_element_into_var () { eval varcontents=\$"$2" eval varname="$2" newcomp="$1" - if echo "$varcontents" | grep "$newcomp:" >> /dev/null; then + if [[ "$varcontents" =~ "${newcomp}:" ]] ; then true - elif [[ "$varcontents" == "" ]] ; then + elif [[ -z "$varcontents" ]] ; then export $varname="$newcomp" else export $varname="$newcomp:$varcontents"