- add egrep -v "^$SPACE$" to eat up whitespace to fix the test failure issue
- adjust GREP selection by using if...then...else style