#!/bin/sh
-vmstat 1 | while read LINE ; do echo "`date +%H:%M:%S`: $LINE" ; done
+null() {
+ :
+}
+
+if [ "$1" == "-q" ]; then
+ echo "echo off"
+ ECHO="null"
+ shift
+else
+ echo "echo on"
+ ECHO=echo
+fi
+vmstat 1 | while read LINE ; do
+ LINE="`date +%s`: $LINE"
+ $ECHO "$LINE"
+ [ "$1" ] && echo "$LINE" >> $1
+done