hibern
1
Hi all,
I try to create a shell script to had the xiti tag at the end of servals web pages just before the <body/> tag.
here is my script :
#!/bin/bash
##################################################################
rm -R /home/hibern/TEMP/hibern
cp -R /home/hibern/TEMP/hibernorig /home/hibern/TEMP/hibern
value=0
cat << EOF > /tmp/xiti.tmp
<!--\
Xt_param = 's=279747&p=';\
try {Xt_r = top.document.referrer;}\
catch(e) {Xt_r = document.referrer; }\
Xt_h = new Date();\
Xt_i = '<img width="39" height="25" border="0" alt="" ';\
Xt_i += 'src="http://logv33.xiti.com/hit.xiti?'+Xt_param;\
Xt_i += '&hl='+Xt_h.getHours()+'x'+Xt_h.getMinutes()+'x'+Xt_h.getSeconds();\
if(parseFloat(navigator.appVersion)>=4)\
{Xt_s=screen;Xt_i+='&r='+Xt_s.width+'x'+Xt_s.height+'x'+Xt_s.pixelDepth+'x'+Xt_s.colorDepth;}\
document.write(Xt_i+'&ref='+Xt_r.replace(/[<>"]/g, '').replace(/&/g, '$')+'" title="Internet Audience">');\
//-->\
</script>\
<noscript>\
Mesure d'audience ROI statistique webanalytics par <img width="39" height="25" src="http://logv33.xiti.com/hit.xiti?s=279747&p=" alt="WebAnalytics" />\
</noscript></a>\
EOF
for file in `find /home/hibern/TEMP/hibern -name '*.html' -print`
do
export m_tag=`cat /tmp/xiti.tmp`
sed -e 's/<body>/'$m_tag'/g' "$file" > "$file".tmp && mv -f "$file".tmp "$file"
done
and here is my error
sed: -e expression #1, char 39: unterminated `s' command
thanks in advance for your help
Try:
sed -e 's/<body>/'"$m_tag"'/g' "$file" > "$file".tmp && mv -f "$file".tmp "$file"
Hi,
Check this
sed -e 's/<body>/${m_tag}/g' "$file" > "$file".tmp && mv -f "$file".tmp "$file"
Thanks,
Thangaraju
vino
4
sed -e "s/<body>/${m_tag}/g" "$file" > "$file".tmp && mv -f "$file".tmp "$file"
Drop all the single quotes and use double quotes. Remember, single quotes disable parameter expansion. See the following
[/tmp]$ a='some text'
[/tmp]$ echo $a
some text
[/tmp]$ echo '$a'
$a
[/tmp]$ echo "$a"
some text
hibern
5
Thanks for your answer, but it's not working
i tried line by line the and i thing this is due to { char. (that' for some thing like a macro)
i have tried with \{ but the probl�me still their
hibern
6
Thanks for your help, my issue is solved, here is the code :