Hi,
I just remembered "grep" use "--basic-regexp" as default.
Should we add "-F" and/or "-e" as soon as the following expression is not 
using regexp or only when necessary?

=== 2 solutions: ===

- add -F or -e only when necessary
     grep "string"
     grep -e "-string"
     grep -F "usb.usermap"
     grep -Fe "-usb.usermap"
     grep -Fe "-usb.usermap"
     grep -Fe "${DUMMY_MSG}"  (because $DUMMY_MSG may contains special chars)
     grep "^string" (basic regexp)
     grep -E "string2|string2" (extended regexp)

- always add -F -e
     grep -Fe "string"
     grep -Fe "-string"
     grep -Fe "usb.usermap"
     grep -Fe "-usb.usermap"
     grep -Fe "-usb.usermap"
     grep -Fe "${DUMMY_MSG}"
     grep -e "^string" (basic regexp)
     grep -Ee "string2|string2" (extended regexp)

I think that the second solution is better to avoid mistakes.

_____
Tux

Reply via email to