theypsilon / Update_All_MiSTer

All-in-one script for updating your MiSTer
GNU General Public License v3.0
667 stars 28 forks source link

replace contains_str function with grep -q #3

Closed frederic-mahe closed 4 years ago

frederic-mahe commented 4 years ago

de-specialize the dot in regex patterns to match exactly what you mean:

echo ".mra xmra" | grep -o "\.mra"
# .mra
echo ".mra xmra" | grep -o ".mra"
# .mra
# xmra
frederic-mahe commented 4 years ago

grep "MRA-Alternatives_[0-9]*\.zip" will also match MRA-Alternatives_.zip. Maybe the pattern could be narrowed to grep "MRA-Alternatives_[0-9][0-9]*\.zip" or grep -E "MRA-Alternatives_[0-9]+\.zip" to force the presence of at least one digit?

theypsilon commented 4 years ago

Thanks for your contribution.

I'm not too worried about MRA-Alternatives_.zip

It would mean something went very wrong in the Updaters/Githubs that we are using here.

Not having a number might be even better for fast detection of the problem, as arithmetic operations will fail, and we'll notice that fast.

frederic-mahe commented 4 years ago

I'm not too worried about MRA-Alternatives_.zip It would mean something went very wrong in the Updaters/Githubs that we are using here. Not having a number might be even better for fast detection of the problem, as arithmetic operations will fail, and we'll notice that fast.

Makes sense. Thanks for pulling in my suggestions!