Loop through a set of HTML files and append text at top and bottom of each file
- by NJTechGuy
For instance, I have an HTML file like this :
a.htm
<body>
Hello world!
</body>
I want :
a.htm
<html>
<LINK href='style.css' rel=stylesheet type='text/css'>
<body>
Hello world!
</body>
</html>
The code I have so far is :
#!/bin/sh
for i in `ls *.htm`
do
@echo off
echo ***New top line*** > temp.txt
type i >> temp.txt
echo ***New bottom line*** >> temp.txt
move /y temp.txt i
done
Errors :
abc@bunny:~/fileAppendText$ ./loopAllFilesTest.sh
./loopAllFilesTest.sh: line 5: @echo: command not found
./loopAllFilesTest.sh: line 7: type: i: not found
./loopAllFilesTest.sh: line 9: move: command not found
./loopAllFilesTest.sh: line 5: @echo: command not found
./loopAllFilesTest.sh: line 7: type: i: not found
./loopAllFilesTest.sh: line 9: move: command not found
./loopAllFilesTest.sh: line 5: @echo: command not found
./loopAllFilesTest.sh: line 7: type: i: not found
./loopAllFilesTest.sh: line 9: move: command not found
Please help. Thanks!