#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 tito_puentes):

 Replying to [comment:1 bdu...@…]:
 > I don't think this is necessary.  We never use echo with flags.  We do
 used ECHO which is defined as /bin/echo which is defined in the functions.

 I don't think you've looked at the patch, nor at the lfs script
 themselves.

 You use echo -ne, and not sparingly.
 >
 > The 'expensive' part is pretty much a non-starter.  On a slow machine,
 how expensive is it (in microseconds)?

 Test it yourself?

 time for i in $(seq 1 1000); do echo str >/dev/null; done

 real    0m0.119s
 user    0m0.123s
 sys     0m0.000s

 time for i in $(seq 1 1000); do /bin/echo str >/dev/null; done

 real    0m2.403s
 user    0m0.000s
 sys     0m0.540s

 >
 > I don't know of any distros that don't use echo, but I only checked RH
 and Ubuntu.
 >
 > Recommend closing as works for me, but I'll leave it open for other
 comments.

 1. Even if it didn't add portability bonuses, it makes the functions less
 complicated and removes a potential dep on a binary.

 2. Ubuntu either uses the binary or doesn't use flags, because they use
 dash by default.

 3. Archlinux uses printf instead of echo.

-- 
Ticket URL: <http://wiki.linuxfromscratch.org/lfs/ticket/2646#comment:2>
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

Reply via email to