Hi all,
I think this could have a simple solution, just I can�t get it so far.
I have the script below that includes several echo commands in order
to show that every part of the script have been executed. A cron job
executes this script and when is completed the output is sent by email.
#!/usr/bin/sh
echo "+++++++++++++++++++++++++++++++++++++++++++++"
echo "+++++++++++++ PROCESS PART 1 +++++++++++++"
echo "+++++++++++++++++++++++++++++++++++++++++++++"
FILE1=$(ls)
for each in $FILE1
do echo "Processing $each...\n";
done
echo "+++++++++++++++++++++++++++++++++++++++++++++"
echo "+++++++++++++ PROCESS PART 2 +++++++++++++"
echo "+++++++++++++++++++++++++++++++++++++++++++++"
FILE2=$(ls *.txt)
for each in $FILE2
do echo "Processing $each...\n";
done
echo "+++++++++++++++++++++++++++++++++++++++++++++"
echo "+++++++++++++++ WORK DONE ++++++++++++++++"
echo "+++++++++++++++++++++++++++++++++++++++++++++"
I only want to receive the output sent by the Cron job
correctly formatted(each echo print in different line)
as shown below:
+++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++ PROCESS PART 1 +++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++
Processing filename1.txt
Processing filename2.txt
Processing filename3.txt
+++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++ PROCESS PART 2 +++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++
Processing filename4.txt
.
.
.
Processing filenameN.txt
+++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++ WORK DONE ++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++
I`ve tested adding \n at the end of every echo command but doesn`t seem to work.
The current output I get in the email received is continuos echo prints like this:
+++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++ PROCESS PART 1 +++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++
Processing filename1.txt...\n Processing filename2.txt...\n Processing filename3.txt...\n
+++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++ PROCESS PART 2 +++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++
Processing filename4.txt...\n ....Processing filenameN.txt...\n
+++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++ WORK DONE ++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++
May somebody help me saying how can I get the echo prints in different line?
Thanks in advance for your help.