mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-31 20:31:19 -03:00
New -n option for read builtin
Usage: read -n nchars Reads maximum of nchars characters. If nchars <= 0, there's no limit.
This commit is contained in:
committed by
Kevin Ballard
parent
677cee44ad
commit
4acea72700
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user