Bonsoir,
Ce soir, c’est SED qui m’énerve
Voici le code BASH incriminé :
html="<article>
<header><strong>${absolufichier}</strong> envoyé sur <em>${servicechoisi}</em><br/><time datetime=\"$(date +%Y-%m-%d\ %H:%M:%S)\">$(date +%d-%m-%Y\ à\ %H:%M:%S)</time></header>
<img src=\""${minilog}"\" alt=\""${minilog}"\" /><br />
<p>${mssg_url}<a href=\""${urlimage}"\">${urlimage}</a><br />
${mssg_mini}${minipourforum}</p>
<footer><hr /></footer>
</article>
</body>"
sed -i -e "s#</body>#$html#g" "${logname}"
Le contenu dynamique de la variable html aura ce style de valeur :
<article>
<header><strong>/home/zou/Images/Capture d'écran - 21012015 - 17:18:49.png</strong> envoyé sur <em>Casimages.com</em><br/><time datetime="2015-06-24 18:42:02">24-06-2015 à 18:42:02</time></header>
<img src="http://nsa38.casimages.com/img/2015/06/24/mini_150624064331250126.png" alt="http://nsa38.casimages.com/img/2015/06/24/mini_150624064331250126.png" /><br />
<p>Accès à l'image : <a href="http://nsa38.casimages.com/img/2015/06/24/150624064331250126.png">http://nsa38.casimages.com/img/2015/06/24/150624064331250126.png</a><br />
Miniature pour forum : [url=http://nsa38.casimages.com/img/2015/06/24/150624064331250126.png][img]http://nsa38.casimages.com/img/2015/06/24/mini_150624064331250126.png[/img][/url]</p>
<footer><hr /></footer>
</article>
</body>
Le fichier “logname” est un simple fichier html, renfermant de base le code suivant :
<!doctype html>
<html lang="fr">
<head>
<title>images sur les forums</title>
<meta charset="utf-8" />
<style type="text/css">
a img { border:0; }
</style>
</head>
<body>
</body>
</html>
Quand j’exécute le script Bash, il me répond :
sed: -e expression n°1, caractère 19: commande `s’ inachevée
Je n’arrive pas à comprendre pourquoi !?