Try using echo to output the string '-e' or '-E' or '-n' literally.
You can't. Furthermore try executing `echo -e [-eEn]...`. Nothing
but a blank line.
The patch below utilizes a familiar technique (used, e.g., in grep) to
escape arguments; however, admittedly it can be rendered more elegant. :)
This was patched against the 03/12/08 coreutils GIT version; however,
echo.c doesn't appear to have changed substantively for years.
=== BEGIN PATCH ===
--- echo.c.orig 2008-03-13 01:33:08.000000000 -0400
+++ echo.c 2008-03-13 01:35:04.000000000 -0400
@@ -145,6 +145,7 @@
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
usage, AUTHORS, (char const *) NULL);
+ char first=1;
--argc;
++argv;
@@ -154,6 +155,14 @@
char const *temp = argv[0] + 1;
size_t i;
+ if (first == 1) {
+ first = 0;
+ if (temp[0] == '-')
+ --argc;
+ ++argv;
+ goto just_echo;
+ }
+
/* If it appears that we are handling options, then make sure that
all of the options specified are actually valid. Otherwise, the
string should just be echoed. */
=== END PATCH ===
Regards,
- A.