diff options
author | Joseph Tannhuber <sepp.tannhuber@yahoo.de> | 2014-08-19 14:28:08 +0200 |
---|---|---|
committer | Kevin Ballard <kevin@sb.org> | 2014-09-03 22:48:37 -0700 |
commit | 4acea72700a7738f1a3258cab226f6153a65ea94 (patch) | |
tree | d7604b0291aade38efd1fc810351014436645687 /tests | |
parent | 677cee44ad192ddcd9a397e82092a3dd27386521 (diff) |
New -n option for read builtin
Usage: read -n nchars
Reads maximum of nchars characters. If nchars <= 0, there's no limit.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/read.in | 16 | ||||
-rw-r--r-- | tests/read.out | 8 |
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/read.in b/tests/read.in index f8787c5c..f864287f 100644 --- a/tests/read.in +++ b/tests/read.in @@ -75,3 +75,19 @@ print_vars ary echo '' | read -la ary print_vars ary set -le IFS + +# read -n tests + +echo +echo '# read -n tests' +echo 'testing' | read -n 3 foo +echo $foo +echo 'test' | read -n 10 foo +echo $foo +echo 'test' | read -n 0 foo +echo $foo +echo 'testing' | begin; read -n 3 foo; read -n 3 bar; end +echo $foo +echo $bar +echo 'test' | read -n 1 foo +echo $foo diff --git a/tests/read.out b/tests/read.out index 1098045d..0de98831 100644 --- a/tests/read.out +++ b/tests/read.out @@ -34,3 +34,11 @@ two 5 'h' 'e' 'l' 'l' 'o' 1 'h' 0 + +# read -n tests +tes +test +test +tes +tin +t |