From 4acea72700a7738f1a3258cab226f6153a65ea94 Mon Sep 17 00:00:00 2001 From: Joseph Tannhuber Date: Tue, 19 Aug 2014 14:28:08 +0200 Subject: New -n option for read builtin Usage: read -n nchars Reads maximum of nchars characters. If nchars <= 0, there's no limit. --- tests/read.in | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/read.in') 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 -- cgit v1.2.3