Thanks for the explanation, but the quoted text does not mention
whether IFS is or is not supposed to interpret escape sequence. If IFS
is a string of characters, I guess most people will regard string
"\t\n" as a two character string, the first one being <tab>, and the
2nd one being the <newline>.



On Fri, May 1, 2009 at 7:01 PM, Herbert Xu <[email protected]> wrote:
> On Fri, May 01, 2009 at 11:33:08AM -0700, Haibo Xu wrote:
>>
>> > #!/bin/sh
>> >
>> > IFS=$' \t\n'
>
> IFS is not supposed to interpret escape sequences.  Quoting POSIX
>
> 1419               IFS                   (Input Field Separators.) A string 
> treated as a list of characters that is used for
> 1420                                     field splitting and to split lines 
> into fields with the read command. If IFS is not
> 1421                                     set, the shell shall behave as if 
> the value of IFS is <space>, <tab>, and
> 1422                                     <newline>; see Section 2.6.5 (on 
> page 2244). Implementations may ignore the |
> 1423                                     value of IFS in the environment at 
> the time the shell is invoked, treating IFS as |
> 1424                                     if it were not set.                  
>                                                   |
>
> So if you want it to have a tab and newline you need to specify
> them literally, or use something that does interpret escapes,
> like
>
> IFS=$(echo '\n\t $')
>
> Cheers,
> --
> Visit Openswan at http://www.openswan.org/
> Email: Herbert Xu ~{PmV>HI~} <[email protected]>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
>
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to