I'm using the following very basic shell script I copied off the net to list the contents of my database backup folder and mail them regularly:
MYSQLLIST=$(ls -lhG /var/backups/mysql/daily/) SUBJECT="daily backup finished" EMAIL="logging@localhost" EMAILMESSAGE="/tmp/emailmessage.txt" echo "dailybackup.sh ran successfully" > $EMAILMESSAGE echo "MYSQL:" >> $EMAILMESSAGE echo $MYSQLLIST >> $EMAILMESSAGE mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
However - regardless the mail reader - in the mail I receive there are no line breaks between the rows of the
ls output, which makes the message terribly hard to read. How could I produce line breaks identical to those I get when executing
ls -lhG on the shell?