I’m using GNU bash, version 3.00.15(1)-release (x86_64-redhat-linux-gnu). And this command:
echo '-e'
doesn’t print anything. I guess this is because ‘-e’ is one of a valid options of echo command because echo ‘-n’ and echo ‘-E’ (the other two options) also produce empty strings.
The question is how to escape the sequence ‘-e’ for echo to get the natural output (‘-e’).
This is a tough one 😉
Usually you would use double dashes to tell the command that it should stop interpreting options, but echo will only output those:
You can use -e itself to get around the problem:
Also, as others have pointed out, if you don’t insist on using the bash builtin
echo, your/bin/echobinary might be the GNU version of the tool (check the man page) and thus understand thePOSIXLY_CORRECTenvironment variable: