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 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:
$ echo -- -e
-- -e
You can use -e itself to get around the problem:
$ echo -e '\055e'
-e
Also, as others have pointed out, if you don't insist on using the bash builtin echo
, your /bin/echo
binary might be the GNU version of the tool (check the man page) and thus understand the POSIXLY_CORRECT
environment variable:
$ POSIXLY_CORRECT=1 /bin/echo -e
-e
You could cheat by doing
echo "-e "
That would be dash, e, space.
Alternatively you can use the more complex, but more precise:
echo -e \\\\x2De
There may be a better way, but this works:
printf -- "-e\n"
[root@scintia mail]# POSIXLY_CORRECT=1; export POSIXLY_CORRECT [root@scintia mail]# /bin/echo "-e" -e [root@scintia mail]#