Closed nir0s closed 4 years ago
Um.. printf is a part of bash since 4.1.7 I believe.
And btw, since performance is very important here, printf is faster :)
Looks like it's also part of the coreutils package in Homebrew.
brady$ which printf
/usr/local/opt/coreutils/libexec/gnubin/printf
Looks like it's also part of the coreutils package in Homebrew.
Seriously, stop using which
. It only knows about commands in your PATH and ignores those builtin ones.
$ type printf
printf is a shell builtin
$ type cat
cat is hashed (/usr/bin/cat)
$ type if
if is a shell keyword
$ type type # of course..
type is a shell builtin
$ command -v printf
printf
$ command -v cat
/usr/bin/cat
$ type command
command is a shell builtin
Um.. printf is a part of bash since 4.1.7 I believe.
Also in bash 3.2.(??) found in OS X I think. man printf
links to a "shell builtins" manpage as far as I can recall.
Personally I'm against this PR because this will remove the POSIX compliance of this little script. However we can replace the echo -en
by printf
.
Finally we should replace #!/usr/bin/env bash
by #!/usr/bin/env sh
On which platforms is printf installed by default?