Skip to content
Joachim Ansorg edited this page Nov 12, 2021 · 3 revisions

egrep is non-standard and deprecated. Use grep -E instead.

Problematic code:

egrep 'foo|bar' file

Correct code:

grep -E 'foo|bar' file

Rationale:

egrep is a non-standard command. Its functionality is provided in POSIX by grep -E. POSIX grep says:

This grep has been enhanced in an upwards-compatible way to provide the exact functionality of the historical egrep and fgrep commands as well. It was the clear intention of the standard developers to consolidate the three greps into a single command.

man grep for GNU says:

Direct invocation as either egrep or fgrep is deprecated

Exceptions:

ShellCheck will fail to recognize when functions override egrep. Consider giving it a different name or ignore this error.

ShellCheck

Each individual ShellCheck warning has its own wiki page like SC1000. Use GitHub Wiki's "Pages" feature above to find a specific one, or see Checks.

Clone this wiki locally