Redirect echo output in shell script to logfile

The Solution to Redirect echo output in shell script to logfile is


You can add this line on top of your script:

#!/bin/bash
# redirect stdout/stderr to a file
exec &> logfile.txt

OR else to redirect only stdout use:

exec > logfile.txt

~ Answered on 2014-09-14 13:24:03


Most Viewed Questions: