aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2019-04-30 17:09:07 -0500
committerRob Landley <rob@landley.net>2019-04-30 17:09:07 -0500
commit333a8c6500981be6cd7391b32bd794a6d6ca91b3 (patch)
tree3385da6b31c73c0cf2b260ebbc1092e1701525e3
parente425ab040b5315d94d59aa4448dc578daf894979 (diff)
downloadtoybox-333a8c6500981be6cd7391b32bd794a6d6ca91b3.tar.gz
Make echo -E switch off -e.
-rwxr-xr-xtests/echo.test1
-rw-r--r--toys/posix/echo.c4
2 files changed, 3 insertions, 2 deletions
diff --git a/tests/echo.test b/tests/echo.test
index fa53559a..248454e7 100755
--- a/tests/echo.test
+++ b/tests/echo.test
@@ -37,3 +37,4 @@ testcmd "-e \p" "-e '\\p'" "\\p\n" "" ""
# http://austingroupbugs.net/view.php?id=1222 added -E
testcmd "-En" "-En 'one\ntwo'" 'one\\ntwo' "" ""
+testcmd "-eE" "-eE '\e'" '\\e\n' "" ""
diff --git a/toys/posix/echo.c b/toys/posix/echo.c
index 11a68a9b..759990a3 100644
--- a/toys/posix/echo.c
+++ b/toys/posix/echo.c
@@ -9,7 +9,7 @@
* We also honor -- to _stop_ option parsing (bash doesn't, we go with
* consistency over compatibility here).
-USE_ECHO(NEWTOY(echo, "^?Een", TOYFLAG_BIN))
+USE_ECHO(NEWTOY(echo, "^?Een[-eE]", TOYFLAG_BIN))
config ECHO
bool "echo"
@@ -21,6 +21,7 @@ config ECHO
by a newline.
-n No trailing newline
+ -E Print escape sequences literally (default)
-e Process the following escape sequences:
\\ Backslash
\0NNN Octal values (1 to 3 digits)
@@ -33,7 +34,6 @@ config ECHO
\t Horizontal tab
\v Vertical tab
\xHH Hexadecimal values (1 to 2 digits)
- -E Print escape sequences literally (default)
*/
#define FOR_echo