I have a little project with HTML. My script to build my HTML is this:
#!/bin/bash
summe=$(find /home/info/PDF -type f | wc -l)
array=()
find /home/info/PDF -type f -print0 >tmpfile
while IFS= read -r -d $'\0'; do
array+=("$REPLY")
done <tmpfile
if [ $summe>0 ]
then
rm -f /var/www/html/index.html
cat header.txt > /var/www/html/index.html
for (( i=0; i<$summe; i++))
do
cat testcontent.txt >> /var/www/html/index.html
done
cat footer.txt >> /var/www/html/index.html
fi
With $summe I count how many PDFs are in my directory, in order to display them at a later stage on my Nginx. In the example, I have 3 PDFs then the content snippet will be set 3 times in my HTML. Now my problem is the name of the PDFs are different and I didn't know how I can change them with SED correctly.
The content snippet:
<div class="content">
<object data="chungus.pdf" style="width:1920px;height:1080px"</object>
</div>
I hope this is enough information and sorry for my bad english I'm still studying.