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