3 ms·
You can with the POSIXLY_CORRECT environment variable: $ /bin/echo --version echo (GNU coreutils) 8.30 Copyright (C) 2018 Free Software Foundation, Inc. Licens
by uplime 5y ago
You can with the POSIXLY_CORRECT environment variable:
$ /bin/echo --version
echo (GNU coreutils) 8.30
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Brian Fox and Chet Ramey.
$ POSIXLY_CORRECT=1 /bin/echo -e
-e
Which is why I say relying on `echo` is fine, since its standard. Relying on `echo` to use options is not. That's also why the author is correct that you should use `printf`, because POSIXLY_CORRECT is not set, then you can run into non-standard behavior, like you showed.