added option for piping the command output to the file