aliases aren't a global state. They're shell and profile specific (as there are plenty of instances where a profile isn't loaded).
With `egrep` defined as a shell script, any process (even callers who are not shells) will have the same behavior.
That doesn't mean the shell script is the best solution though. Personally I'd rather they be a symlink to `grep` and have grep check the name it's been invoked as, and if it's "egrep" (or "e" if you're just checking the first byte) then implicitly enable the -E flag. This is how FreeBSD works and it feels like a more elegant solution in my opinion.
With `egrep` defined as a shell script, any process (even callers who are not shells) will have the same behavior.
That doesn't mean the shell script is the best solution though. Personally I'd rather they be a symlink to `grep` and have grep check the name it's been invoked as, and if it's "egrep" (or "e" if you're just checking the first byte) then implicitly enable the -E flag. This is how FreeBSD works and it feels like a more elegant solution in my opinion.