I am having this controversial commentary on this answer to a question whether we should use fgrep or grep with the -F
switch (i.e grep -F
) for portability. The points that have been came into light so far are:
grep -F
:
- Is a POSIX Standard.
- GNU
grep
has declaredfgrep
to be deprecated.
fgrep
:
- Historically it came before the
grep -F
option. - Even though GNU grep declared
fgrep
to be deprecated, they seem to stick with it for its historical use.
If you consider old (really old) systems, then probably you can find some of them not having the grep -F
in them (and I think the chance of it happening is very rare). But do we really need to worry about those very very old machines and avoid POSIX standard for that!!
If you think about the current situation and include those old machines (which supposedly/allegedly don't have grep -F
), then there will be more systems supporting fgrep
.
On the other hand, if you look to the future, fgrep
is going to be a history and grep -F
will triumph upon it as a POSIX standard.
And moreover isn't it a generally accepted practice now to use the POSIX standard for better portability?