1 | #!/usr/bin/env bash |
2 | set -euo pipefail |
3 | |
4 | read-one () { |
5 | # try typing a letter without hitting newline |
6 | # the shell should respond immediately |
7 | read -n 1 |
8 | echo |
9 | echo "$REPLY" |
10 | } |
11 | |
12 | read-multiple () { |
13 | read -n 5 |
14 | echo |
15 | echo "$REPLY" |
16 | } |
17 | |
18 | all () { |
19 | echo "one char:" |
20 | read-one |
21 | echo "multiple chars:" |
22 | read-multiple |
23 | } |
24 | |
25 | "$@" |