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 regularily:
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 linebreaks between the rows of the
ls output, which makes the message terribly hard to read. How could I produce linebreaks identical to those I get when executing
ls -lhG on the shell?