I have a file which was created by a script which will be colored when I open using cat
. But when I tried to send that file as attachment, it is not showing properly. Like below it is showing.
^[[33m================================================================================^[[m
^[[34m172.29.0.110^[[m
^[[33m================================================================================^[[m
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos 109G 13G 91G 13% /
/dev/mapper/mpatha 1.6T 1.3T 277G 83% /var/lib/SQL
^[[33m================================================================================^[[m
^[[34m172.29.8.110^[[m
^[[33m================================================================================^[[m
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos 117G 9.1G 102G 9% /
/dev/mapper/mpatha 1.6T 1.4T 109G 93% /var/lib/SQL
^[[33m================================================================================^[[m
^[[34m172.29.16.110^[[m
^[[33m================================================================================^[[m
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos 117G 18G 94G 17% /
/dev/mapper/VG01-LV 1.5T 812G 590G 58% /var/lib/SQL
^[[33m================================================================================^[[m
^[[34m172.29.26.110^[[m
^[[33m================================================================================^[[m
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/LogVol02 117G 22G 90G 20% /
/dev/mapper/mpathm 1.6T 1.1T 435G 71% /var/lib/SQL
The script(part of the script) that creates the file is ::
for IP in $(cat file.txt); do
(echo -e "\e[33m$LINE\e[m"
echo -e " \e[34m$IP\e[m "
echo -e "\e[33m$LINE\e[m"
echo -e "Filesystem\t\tSize\tUsed\tAvail\tUse%\tMounted\ton"
ssh $SSH_ARG -q user@${IP} "df -Ph | egrep -iv 'filesystem|boot|tmpfs'") >> /disk_${DATE}_log
echo -e "\e[33m$LINE\e[m"
echo "Successful for $IP"
done
cat disk_${DATE}_log | mail -s "Disk space" mail@mail.com
I can remove those echo
's that creating colors, but I want to know is there any way I can send this file properly by mail or can I do something in mail command to solve this?
text/plain
mail messages with thesendmail
andecho
commands; or how to view the aforegiven bodypart in such a way that the escape sequences are processed. – JdeBP Mar 25 '17 at 14:12