Hi Peter,

peter kvillegard wrote:

> test1(space)test2(tab)test3
> 
> (where the "(space)" is an actual space etc)
> then:
> 
> #!/bin/dash
> 
> cat testfile |
> while IFS='   ' read col1 col2; do    #an actual tab

In my mailreader, this shows as

        "while" SP "IFS='" SP SP HT "'" SP "read" ...

In particular, IFS contains a space and a tab.  So I would expect
"$col1" to be "test1" and "$col2" to be "test2  test3".

> echo $col1
> echo $col2

Because unquoted, $col2 is subject to word splitting.  So echo
receives arguments "test2" "test3" and separates them with a space.

> done
>
> exit 0
>
> it gives the output:
>
> test1
> test2 test3

Looks good to me. ;-)

See http://unix.org/2008edition/ for details.

Hope that helps,
Jonathan
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to