12 ms·
Because `echo -n` is a BSD-ism that's not supported on System V derivatives¹. It's perfectly legitimate for: echo -n "please hash this data" ...to output
by thristian 3y ago
Because `echo -n` is a BSD-ism that's not supported on System V derivatives¹. It's perfectly legitimate for:
echo -n "please hash this data"
...to output the bytes "-n please hash this data\n", which is even more misleading than the extra newline echo outputs normally.
¹: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html https://pubs.opengroup.org/onlinepubs/9699919799/utilities/e...
- natch 3y agoThanks for mentioning that! I learned something.
- throw0101b 3y agoThe newline may also be suppressed by appending `\c' to the end of the string, as is done by iBCS2 compatible systems. Note that the -n option as well as the effect of `\c' are implementation-defined in IEEE Std 1003.1-2001 ("POSIX.1") as amended by Cor. 1-2002. For portability, echo should only be used if the first argument does not start with a hyphen (`-') and does not contain any backslashes (`\'). If this is not suffi- cient, printf(1) should be used. * https://man.freebsd.org/cgi/man.cgi?query=echo https://man.freebsd.org/cgi/man.cgi?query=echo \c Suppress the <newline> that otherwise follows the final argument in the output. All characters following the '\c' in the arguments shall be ignored. * https://man7.org/linux/man-pages/man1/echo.1p.html https://man7.org/linux/man-pages/man1/echo.1p.html