added options parsing for "-l <logfile>" option.

If log given, log to it, else stdout.

run commands thru one function: runCmd() which will log if -l option
seen.