Timeline for Why is printf better than echo?
Current License: CC BY-SA 3.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 24 at 6:40 | comment | added | glacier |
Someone came to the opposite conclusion in this answer by using time.
|
|
| Dec 29, 2018 at 16:03 | comment | added | Stéphane Chazelas |
@schily, the behaviour of printf is unspecified by POSIX if you use \c in the format string, so printf implementations can do whatever they want in that regard. For instance, some treat it the same as in the PWB echo (causes printf to exit), ksh uses it for \cA control characters (for the printf format argument and for $'...' but not for echo nor print!). Not sure what that has to do with printing NUL bytes, or maybe you're refering to ksh's printf '\c@'?
|
|
| Jul 3, 2018 at 14:46 | comment | added | schily |
But many of those printf implementations are broken. This is essential when you like to use printf to output nul bytes, but some implementations interpret `\c' in the format string even though they should not.
|
|
| Nov 7, 2014 at 13:52 | comment | added | Stéphane Chazelas |
printf is built in most shells nowadays (bash, dash, ksh, zsh, yash, some pdksh derivatives... so includes the shells typically found on cygwin as well). The only notable exceptions are some pdksh derivatives.
|
|
| Oct 3, 2014 at 17:18 | review | Late answers | |||
| Oct 3, 2014 at 17:21 | |||||
| Oct 3, 2014 at 17:05 | history | edited | HalosGhost | CC BY-SA 3.0 |
code escapes
|
| Oct 3, 2014 at 17:03 | review | First posts | |||
| Oct 3, 2014 at 17:05 | |||||
| Oct 3, 2014 at 17:00 | history | answered | John | CC BY-SA 3.0 |