bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash "while do echo" can't function correctly


From: John McKown
Subject: Re: bash "while do echo" can't function correctly
Date: Wed, 13 Apr 2016 06:34:23 -0500

On Wed, Apr 13, 2016 at 1:10 AM, Geir Hauge <geir.hauge@gmail.com> wrote:

​...
 
though printf should be preferred over echo:

    while read -r line; do printf '%s\n' "$line"; done < test.txt

​I've never read about using printf in preference to echo. Why is that? ​I have used it myself in special cases, such as wanting leading zeros (i=0;printf '%03d\n' "${i}";)

 

--
Geir Hauge




--
How many surrealists does it take to screw in a lightbulb? One to hold the griffon and one to fill the bathtub with brightly colored LEDs.

Maranatha! <><
John McKown

reply via email to

[Prev in Thread] Current Thread [Next in Thread]