#!/bin/bash log=/root/bin/test.log exec &> "$log" >>"$log" 2>&1 echo "line 1" echo "line 2" ls echo "the remainder..." echo " " echo -n "start of the line " echo "end of the line" echo "the end"