Bug#490605: debian-policy: please discourage the usage of echo -n, and echo in general
On Sat, 12 Jul 2008, Raphael Geissert wrote:
> Package: debian-policy
> Version: 22.214.171.124
> Severity: wishlist
> As demonstrated by the following trivia, and also mentioned by SUSv3, the
> echo built-in varies from implementation to implementation and thus should be
Well, you just proved that you can't rely on correct interpretation
of special escaped characters and that's true. It's not a reason
to discourage echo or echo -n in general though. That would be ridiculous
given how frequently it's used.
But it would be nice to remember that printf "" must be used if you want
to reliably use escaped characters. But here you must take care to
use "%s" for each variable expansion:
echo "a $var\n b"
printf "a %s\n b\n" "$var"
Le best-seller français mis à jour pour Debian Etch :