point d'exclamation dans un fichier HTML
Bonjour,
J'ai developpé un script Unix et lors de l'envoi des résultats par mail, je me retrouve avec des points d'exclamation qui trainent dans le code source du mail et me détruit la mise en page sans que je comprenne pourquoi :
Citation:
Application: tata
Date Exploitation: 22-03-2012
Application: tutu
Date Exploitation: 22-03-2012
Application: titi
Date Exploitation: 22-03-2012
Applic!
ation:toto
Date Exploitation: 22-03-2012
Merci d'avance pour qui pourra m'aider
pint d'exclamation + SCRIPT
Bonjour,
Le voici ;) :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
#Commande et mise en forme du fichier
ListeDates="Validation des dates d'exploitation:"
tlist -v dates > dates.txt
cat dates.txt | cut -c1-27 | awk '{print $1,$2}' | sed "s/ /|/g" > dates.txt
cat dates.txt | awk -F '|' 'NR==1 , NR==17 {print "Application: " ,$1"@space@","Date Exploitation:" ,$2"@space@"}' > dates1.txt
DATES=`cat dates1.txt`
# Color Initialisation
#bold=$(tput smso)
bold="\\\033[1;40m"
offbold=$(tput rmso)
#underline=$(tput smul)
underline="\\\033[4;40m"
offunderline=$(tput rmul)
ResetColor="\\\033[m"
Red="\\\033[1;31m"
Green="\\\033[32m"
Yellow="\033[33m"
Blue="\\\033[34m"
Purple="\\\033[35m"
BlueCyan="\\\033[36m"
# Script Configuration
# Mails
_mail="TRUE"
f_mailscript="mail_color.txt"
RES_FINAL="temp_file.tmp"
[ -f $RES_FINAL ] && rm $RES_FINAL
# Creation mail
_sendmail()
{
typeset _f_mailcontent=$1
typeset _f_mailscript=$2
typeset _date=$(echo `date +i"%d-%m-%Y %H:%M"`)
typeset _subject=`echo ### $_date - Result .`
(
echo "/usr/sbin/sendmail -F'xxx' -t << __EOF__"
echo "To: xxx@xxx.xx"
echo "MIME-Version: 1.0"
echo "Content-Type: multipart/alternative; "
echo ' boundary="NVN54150.1234567890/xxxx"'
echo "Subject:xxxx du : $(echo $(date +"%d-%m-%Y"))"
echo "--NVN54150.1234567890/xxxx"
echo "Content-Type: text/html"
echo ""
echo "<html>
<head>
<title>xxxx and Mail in color $(echo $(date +%d-%m-%Y))</title>
</head>
<body>
<div>
<pre>
$(cat ${_f_mailcontent})
</pre>
</div>
</body>
</html>"
echo "__EOF__"
) > ${_f_mailscript}
sh ${_f_mailscript}
rm -f ${_f_mailscript}
}
#Interpretation en HTML
_Print_HTML()
{
data_HTML="`echo "${1}" | sed "s/@Reset@/\<\/font\>/g" | sed "s/@Blue@/\<font\ color=blue\>/g" | sed "s/@Red@/\<font\ color=red\>/g" | sed "s/@Green@/\<font\
color=green\>/g" | sed "s/@BlueCyan@/\<font\ color=cyan\>/g" | sed "s/@underline@/\<u\>/g" | sed "s/@offunderline@/\<\/u\>/g" | sed "s/@bold@/\<b\>/g" | sed
"s/@offbold@/\<\/b\>/g" | sed "s/@space@/\<br\ \/\>/g" | sed "s/@nospace@/\<\/br\ \/\>/g" | sed "s/@parag@/\<p\>/g" | sed "s/@noparag@/\<\/p\>/g"`"
echo $data_HTML >> $RES_FINAL
}
#Appel fonction et passage de paramètres
_Print_HTML "@parag@@bold@@underline@@Green@$(echo ${ListeDates})@Reset@@offunderline@@noparag@
@bold@@Blue@$(echo ${DATES}) @Reset@@noparag@"
#Envoi mail
[ ${_mail} = "TRUE" ] && _sendmail $RES_FINAL $f_mailscript |