emersion / mrsh

A minimal POSIX shell
MIT License
489 stars 35 forks source link

read does not seem to split input fields according to a given variable list #155

Open Earnestly opened 4 years ago

Earnestly commented 4 years ago

For a given script such as:

printf 'a b\n' | while read -r field1 field2; do
    printf '[%s]\n' "$field1" "$field2"
done

I would expect the following output:

[a]
[b]

However with mrsh this is printed instead:

[a b]
[]

I wasn't able to find an open or closed issue regarding this so I'm unsure whether this is known issue.

PS: mrsh also seems to block on read when used in a while loop reading from a redirected file, such as while read -r ...; do ...; done < file. Should I make an issue for this too?