summaryrefslogtreecommitdiffhomepage
path: root/bench/heredoc.sh
blob: 40df15413cf2d786f5d9c67ab50f268dcd8af341 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh
# Here-documents: 2000 bodies, each read back with the read builtin.
i=0
n=0
while [ $i -lt 6000 ]; do
    while read -r a; do n=$((n + ${#a})); done <<EOF
alpha $i
beta $n
EOF
    i=$((i + 1))
done
echo "$i $n"