Re: Dash problem with IFS

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

 



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~} <herbert@xxxxxxxxxxxxxxxxxxx>
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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux