[Top][All Lists]

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

Re: AW: Questions to bash "read" builtin functionality

From: Greg Wooledge
Subject: Re: AW: Questions to bash "read" builtin functionality
Date: Wed, 19 Dec 2012 17:02:14 -0500
User-agent: Mutt/

On Wed, Dec 19, 2012 at 04:49:32PM -0500, Chet Ramey wrote:
> I get the same results if I run the pipeline in an interactive shell.
> This is pretty much what I expect.  The whitespace and newlines will
> disappear due to read's $IFS processing if they're first or last in
> the string.

Which is why you typically want:

  IFS= read -r foo

This is especially true when you're reading N bytes at a time and need
them preserved verbatim.  (You can also use -d '' to suppress stopping
on a newline character, if that helps.)

reply via email to

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