I've come across a few answers/comments on this site that using the %b
directive bash
's printf
command is not recommended. Is this true? If so, why? It seems better than using echo
with the -e
option since echo
won't print strings that begin with a valid option name.
Asked
Active
Viewed 550 times
0

Melab
- 2,594
- 7
- 30
- 51
-
3This might help: [What is more portable? echo -e or using printf?](https://stackoverflow.com/q/11530203/3776858) – Cyrus Jul 08 '17 at 15:40
-
Of course, `printf` with `%b` isn't any more portable than `echo -e`, because both are `bash` extensions. – chepner Jul 08 '17 at 17:27
-
@chepner are you sure? `%b` is document [here](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html) in POSIX, number 7 under EXTENDED DESCRIPTION – Eric Renouf Jul 08 '17 at 18:34
-
Huh. The `bash` man page describes it as an extension; wonder if that is old wording that was never updated? – chepner Jul 08 '17 at 20:06