#!/bin/bash ring() { : } trap ring SIGALRM { while true do sleep 2 kill -s SIGALRM $$ done } & # run an "alarm clock" that rings the parent every second second while IFS=$'=' read key value # while read key do # value=${key#*=} # key=${key%%=*} echo Read: key=\"$key\" value=\"$value\" done < <( # This is to emulate a process which output we read while true do sleep 1 echo key=value done ) exit