aboutsummaryrefslogtreecommitdiff
path: root/bin/clwr
blob: af39276aebec97df093e06692a2826e7ad1ae440 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env bash
self=clwr
if (($# != 1)) ; then
    printf >&2 '%s: Need output file\n' "$self"
    exit 2
elif [[ ! -t 0 ]] ; then
    printf >&2 '%s: stdin not a terminal\n' "$self"
    exit 2
elif [[ ! -t 1 ]] ; then
    printf >&2 '%s: stdout not a terminal\n' "$self"
    exit 2
fi
exec 3>"$1"
while { clear && IFS= read -er line ; } ; do
    printf '%s\n' "$line" >&3
done