Added a func for getting the output of cmd - written by UnixJunkie as proposal for Batteries.