Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
uplime
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
4 ms
·
1.
▲
by
uplime
5y ago
> You seem to have a very narrow definition of "portable." Can you explain how wanting to include more programs into the definition of portable is narrow? > Can you link to the definition of the jargon term you appear to be
2.
▲
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
3.
▲
by
uplime
5y ago
It makes relying on meaningful options passed to `echo` non-portable. You can always rely on `echo` being on the system (thanks to POSIX), which is what makes it portable. Relying on the behavior of -e/-n/etc is not.
4.
▲
by
uplime
5y ago
GNU coreutils isn't a standard. It conforms to and extends the POSIX standard. If it was just talking about GNU echo, then that `echo` would work the same on every machine. It even explicitly mentions other `echo` implementations, like
5.
▲
by
uplime
5y ago
It probably is what they meant. However, what was written is that `echo` itself is non-portable, which isn't correct.
6.
▲
by
uplime
5y ago
> echo is non portable and its behaviour diverges between systems and shell builtins `echo` is portable: https://pubs.opengroup.org/onlinepubs/009695399/utilities/ec... Any options passed to `echo` are not