#2646: scripts should use printf instead of echo
--------------------------+-------------------------------------------------
Reporter: tito_puentes | Owner: lfs-b...@…
Type: defect | Status: new
Priority: low | Milestone: 6.7
Component: Bootscripts | Version: SVN
Severity: minor | Keywords: echo printf POSIX
--------------------------+-------------------------------------------------
Comment(by bon):
Replying to [comment:5 matt...@…]:
> `printf' is generally preferred to `echo' for portability reasons. See
http://www.gnu.org/software/hello/manual/autoconf/Limitations-of-
Builtins.html#echo for the various portability issues around using `echo'.
>
> In a default LFS install, bash provides both `printf' and `echo' as
shell builtins so if we remove the '/bin/' prefix from our calls to echo
then there's no speed difference at all between the two.
>
> From a quick google, bash provides both printf and echo as builtins, as
does zsh. csh, dash, ksh & tcsh all offer echo, but not printf.
$ dash -c 'type printf'
printf is a shell builtin
tcsh can't even read the script to begin with
>
> I've got a preference for portability over speed here; the slowdown
caused by not using a shell builtin is probably going to be less
noticeable than the portability issues if someone does decide to use a
shell other than Bash.
--
Ticket URL: <http://wiki.linuxfromscratch.org/lfs/ticket/2646#comment:6>
LFS Trac <http://wiki.linuxfromscratch.org/lfs/>
Linux From Scratch: Your Distro, Your Rules.
--
http://linuxfromscratch.org/mailman/listinfo/lfs-book
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page