Long story short, narrowed my problem down to a one-liner:
for a in {a..z}; do echo "-$a" | grep "\-$a"; done
This prints all letters but -e
and -n
.
Looks like Linux version, bash version, flags to grep (-P
, -E
) etc do not matter!
Tested environments:
- GNU bash, version 3.2.57(2)-release (x86_64-suse-linux-gnu) on SUSE Linux Enterprise Server 11 SP4
- GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin) on Cygwin (base-cygwin 3.8-1; cygwin32 2.10.0-1)
- rextester (bash online compiler; GNU bash 4.3.46)
Why are not -e
and -n
printed?
(Removing the dashes in the code also removes the problem)