On Tue, 8 Jun 2021 10:05:28 +0300 Claudiu Zissulescu <claz...@gmail.com> wrote:
> Thank you for your input. > > I have made an update using grep's ERE. Please let me know if it is ok. I would have written [[:space:]]* instead of [[:space:]]+ to handle potentially missing space, at least after the comma but also before the comma to avoid surprises for new names in the future. Furthermore <space>|<tab> alone would be [[:blank:]]* but as you prefer. grep ... > /dev/null would be grep -q which is mandated by POSIX since at least SUSv2 so can be used safely since quite some time now. Instead of the redundant 'true' calls, i'd usually write : E.g. if grep -q ... ; then : else echo "nah"; exit 1 fi Which could be shortened to if ! grep -q ... then echo "nah" exit 1 fi to avoid any questions about an empty arm in the first place. ISTM you only set the expected flags in the switch so i would have set only that variable and have grepped only once after the switch for brevity. Either way, thanks for not using grep -P :) thanks,