- https://www.gnu.org/software/bash/manual/html_node/Conditional-Constructs.html — look for the very helpful xxx.txt example!
I was tempted to put the entire pattern in (double) quotes. But that’s not Bash style. You can “certainly” put literal parts in quotes, but regexp parts do not belong in quotes — quotes are good for protecting, amongst other aspects: protecting against interpretation as regular expression. That’s different to usual programming languages. Usually you do sort of put your entire regular expression in “borders” — in Bash you don’t.
This example resp. advice is actually quite wrong (but I am not able to comment there — I have not earned enough reputation on stackoverflow.com yet):
- https://stackoverflow.com/a/13542845/3119172 – the pattern shown there must not be put in quotes
Leave a Reply