[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: The <newline> character can also be an "IFS whitespace character"
From: |
Chet Ramey |
Subject: |
Re: The <newline> character can also be an "IFS whitespace character" |
Date: |
Tue, 20 Oct 2015 10:51:26 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
On 10/20/15 10:21 AM, ziyunfei wrote:
> Quoting from the bash manual:
>
> "If IFS has a value other than the default, then sequences of the whitespace
> characters *space and tab* are ignored at the beginning and end of the word,
> as long as the whitespace character is in the value of IFS (an IFS whitespace
> character)."
>
> If this is true, then the following script
>
> $ IFS=$'\n'
> $ a=$'\n1\n2\n'
> $ printf "%s\n" $a
> 1
> 2
>
> should print <> <1> <2> 3 fields, but it doesn't.
>
> So I guess *space and tab* should be replace by *space, tab and newline* in
> that section.
That seems reasonable.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/