|
From: | Roman Rakus |
Subject: | Re: Why `echo -n hello | while read v; do echo $v; done' prints nothing? |
Date: | Thu, 02 Dec 2010 16:48:07 +0100 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101103 Fedora/1.0-0.33.b2pre.fc14 Thunderbird/3.1.6 |
On 12/02/2010 12:04 PM, Clark J. Wang wrote:
Following command also prints nothing, confused :( for ((i = 0; i< 10; ++i)); do echo -n " $i"; done | while read v; do echo $v; done
read wants to read one line, but you don't end your line. try this two examples: $ printf '1 2 3 4' | while read v; do echo $v; done $ printf '1 2 3 4\n' | while read v; do echo $v; done RR
[Prev in Thread] | Current Thread | [Next in Thread] |