fgrep或grep -F,哪一个更适合便携式脚本? [英] fgrep or grep -F, which one is better for portable script?
问题描述
我对这个回答有这个有争议的评论,是否应该使用 fgrep 或 -F 开关(即)显示标记为'grep'rel =tag> grep
的问题。 grep -F )的可移植性。到目前为止发现的几点是:
$ b
grep -F
:
- 是POSIX标准版。
- GNU
grep
code> fgrep 将被弃用。
- GNU
如果你考虑过旧的系统,那么你可能会发现其中一些没有 如果您考虑当前的情况并包括那些旧机器据称/没有 另一方面,如果你展望未来, 此外,现在使用POSIX标准的更好的可移植性? 这个问题有点基于意见。即便如此,我想把我的两分钱放在这里: - 正如你所提到的, 这些用户可以通过 轻松说服 来自官方GNU Grep项目页面的GNU grep。在我的系统中,grep的版本是2.20(Linux - CentOS 7; kernel - 3.10)。 为了某种目的发布了更新的软件版本---以改进以前的版本并删除任何类型的错误等。所以,这里GNU Grep已经建议使用 保留旧代码仅仅是为了保留遗留代码会违反它,但是,再次为了将来的用法,应该坚持POSIX标准,并且总是使用 I am having this controversial commentary on this answer to a question whether we should use fgrep or grep with the If you consider old (really old) systems, then probably you can find some of them not having the If you think about the current situation and include those old machines (which supposedly/allegedly don't have On the other hand, if you look to the future, And moreover isn't it a generally accepted practice now to use the POSIX standard for better portability? This question is a bit primarily opinion based. Even then I'd like to put my two cents here :- As you mentioned that Those users can be easily persuaded to download a new version of GNU grep from the official GNU Grep project page. Like in my system the version of grep is 2.20(Linux - CentOS 7; kernel - 3.10). So, I'd present 2 reasons :- Newer software versions are released for some purpose --- to improve from the previous version and remove any kind of bugs,etc. So, here GNU Grep already recommends to use And, downloading and installing a new version of software is not a much complex task. it doesn't require any extra new library or something as a dependency, just a better version which does all kinds of search, which removes liability of using Sticking with older ideas just to preserve legacy codes would be a point against it, but, then again for future usages one should stick to POSIX standard and always use 这篇关于fgrep或grep -F,哪一个更适合便携式脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! fgrep $
grep -F
选项之前。
fgrep
的GNU grep被弃用,它们似乎也会坚持使用它。
grep -F code>(我认为它发生的机会非常罕见)。但是我们是否真的需要担心那些非常旧的机器,并且为此避免使用POSIX标准!!
grep -F
),那么会有更多系统支持 fgrep
。
fgrep
将成为历史,而 grep -F
将作为POSIX标准取胜。
fgrep
将会是一个历史记录,同时也是 grep -F
是POSIX标准,那么允许是OK(用于保留遗留代码)。在我看来,使用fgrep是完全荒谬的。
因此,我会提出两个原因: -
grep -F
这是一个POSIX标准。 fgrep
>
grep -F
。 -F
switch (i.e grep -F
) for portability. The points that have been came into light so far are:grep -F
:
grep
has declared fgrep
to be deprecated.fgrep
:
grep -F
option.fgrep
to be deprecated, they seem to stick with it for its historical use.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!!grep -F
), then there will be more systems supporting fgrep
.fgrep
is going to be a history and grep -F
will triumph upon it as a POSIX standard.fgrep
is going to be a history and also grep -F
is a POSIX standard, then permitting is OK(for preserving legacy codes); using fgrep in my view is totally absurd.
grep -F
which is a POSIX standard.fgrep
anymore.grep -F
.