At the moment I have the following code:
vmstat -n ${INTERVAL} | {
read line
read line
read line
while read line ; do
store-vmstat ${line}
done
}
This does what I want, but with the pipe there is a fork that should not
be necessary.
I tried the following:
{
read line
read line
read line
while read line ; do
store-vmstat ${line}
done
} <<< "$(vmstat -n ${INTERVAL})"
Redirecting from the output of a command does work, but it looks like
the redirection only starts after the command is finished and this
command never finishes.
I also tried:
} <<< "$(stdbuf -oL vmstat -n 10 15)"
and:
} <<< "$(pty vmstat -n 10 15)"
to no avail. Does anybody know how to do this, or is the pipe solution
the way to go?
--
Cecil Westerhof
Senior Software Engineer
LinkedIn:
http://www.linkedin.com/in/cecilwesterhof