Skip to content

Instantly share code, notes, and snippets.

@hilotech
Created October 10, 2015 11:45
Show Gist options
  • Save hilotech/045f53f894f97625b56d to your computer and use it in GitHub Desktop.
Save hilotech/045f53f894f97625b56d to your computer and use it in GitHub Desktop.
#!/bin/bash
# Usage: (cat /etc/fstab && sleep 20 && cat /etc/fstab ) | ./test.sh
interval=10
function _do() {
echo "$@" | cat -n
}
CR='
'
while true
do
buffer=''
while read -t ${interval-} line
do
buffer="${buffer-}${line-}${CR-}"
done
if [[ -z "${buffer-}" ]]; then
continue
fi
_do "${buffer-}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment