1#!/bin/bash
2
3if [ $# -ne 2 ]
4then
5    echo "Usage: $0 outputfile command" >&2
6    exit 1
7fi
8
9output=$1
10shift
11fast=0
12
13(sleep 3
14 while IFS= read -r line
15 do
16    case "$line" in
17        '##FAST' ) fast=1 ;;
18        '##SLOW' ) fast=0 ;;
19        * ) echo "$line" ;;
20    esac
21    if [ $fast -eq 0 ] ; then sleep 1 ; fi
22 done) | script $output "$@"
23