Commit graph

3 commits

Author SHA1 Message Date
Joseph Tannhuber
4acea72700 New -n option for read builtin
Usage: read -n nchars
Reads maximum of nchars characters. If nchars <= 0, there's no limit.
2014-09-03 22:48:37 -07:00
Kevin Ballard
7fce9e2411 Trim trailing newline on cmdsubst when IFS=''
When $IFS is empty, command substitution no longer splits on newlines.
However we still want to trim off a single trailing newline, as most
commands will emit a trailing newline and it makes it harder to work
with their output.
2014-08-29 12:48:45 -07:00
Kevin Ballard
973dd6ffbd read: Support arrays, character splitting
Enhance the `read` builtin to support creating an array with the --array
flag. With --array, only a single variable name is allowed and the
entire input is tokenized and placed into that variable as an array.

Also add custom behavior if IFS is empty or unset. In that event, split
the input on every character, instead of the previous behavior of doing
no splitting at all.
2014-07-14 00:46:38 -07:00