Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11723

Re: The <newline> character can also be an "IFS whitespace character"

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: The <newline> character can also be an "IFS whitespace character"
Date 2015-10-20 10:51 -0400
Message-ID <mailman.687.1445352706.7904.bug-bash@gnu.org> (permalink)
References <F0C8DFA2-613A-4AAC-8866-F50BF1F8532E@qq.com>

Show all headers | View raw


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/

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: The <newline> character can also be an "IFS whitespace character" Chet Ramey <chet.ramey@case.edu> - 2015-10-20 10:51 -0400

csiph-web