aboutsummaryrefslogtreecommitdiff
path: root/bin/clrd
blob: 0b4606717210f07da2a5f82a356d173e8c729629 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh
# Clear the screen and read a file as it's written line-by-line
self=clrd

# Check we have an input file and are writing to a terminal
if [ "$#" -ne 1 ] ; then
    printf >&2 '%s: Need input file\n' "$self"
    exit 2
elif ! [ -t 1 ] ; then
    printf >&2 '%s: stdout not a terminal\n' "$self"
    exit 2
fi

# Clear the screen and start tailing out the file
clear
tail -f -- "$@"