Perpetual PC's

Web Site Design.       Networks.

Commands and references ( GNU / linux kernel 2.4.18-3 and 2.4.18-14 )   
Linux is a registered trademark of Linus Torvalds


The commands with their most common usage are in brackets like this: [ command ].
Don't type the brackets, just what is inside of them.

Back to the index page


This is the script I used to make all the man/html pages. It's not perfect and its somewhat slow; but not nearly as slow as trying to manually edit all the pages one at a time in an editor! There are thousands of changes that need to be made and the script does most of it. It took a few hours to write the script and 5 minutes to run it - try creating and editing 200+ html files individually in several hours and make them all w3c compatible. This may not be the most elegant code in the world but it worked and only took about 5 minutes to do all the manual pages that you see on the command reference page, and furthermore it would be possible to do all the commands (over 2000 on my system) with only a few modifications. For the script to work the "acirc euro and trade" on lines 42,44 and 47 may need to be converted after you download the script
#!/bin/sh
#this script puts together webpages to display manual pages online. 
#the parts are put together by splitting up an html template page
#and inserting the various components at the appropriate place
#and then re-assembling the template with the content from the manual pages
#
#
#
#open file notable_commands.txt for reading - this would be the file where the names of the 
#commands have been stored neatly on single lines with no spaces or punctuation.
exec 6<notable_commands.txt
# read until end of file
while read -u 6 dta
do
  
#put the lines from notable_commands.txt into $name through dta 
   name=$dta
   
#create a file with the name of each line in the file being read
   touch srtd_$name.html
   
#put our pre_written top portion into the $name html file without destroying the template
   cat top_title.html >> srtd_$name.html
   
#set up title with the name of the command read from the line of the file notable_commands.txt
   echo $name >> srtd_$name.html
   cat bottom_title.html >> srtd_$name.html

   cat top_file.html >> srtd_$name.html
  
   
#get the man page into the right spot in our html template file

   man $name | col -b > man_$name.txt
   sed 's/'\>'/)/gi' man_$name.txt > document1
   sed 's/'\<'/(/gi' document1 > document2
   cat document2 >> srtd_$name.html
   cat bottom_file.html >> srtd_$name.html
   
#use tidy to clean up the html code and replace unrecognizeable characters with html recognizable
   tidy -m srtd_$name.html
   mv srtd_$name.html tmp_srtd_$name.html
   sed 's/’/`/gi' tmp_srtd_$name.html > srtd_$name.html
   mv srtd_$name.html tmp_srtd_$name.html
   sed 's/â€/`/gi' tmp_srtd_$name.html > srtd_$name.html
   mv srtd_$name.html tmp_srtd_$name.html
#replace capital A with "hat" with period
   sed 's/Â/./gi' tmp_srtd_$name.html > srtd_$name.html
   mv srtd_$name.html tmp_srtd_$name.html
#replace tilde with space
   sed 's/˜//gi' tmp_srtd_$name.html > srtd_$name.html

   rm man_$name.txt
   rm tmp_srtd_$name.html

done
# close file test.data
exec 6E&-

rm srtd_name.html

mkdir storit_rev1

mv *.html storit_rev1

cd storit_rev1

cp top_file.html /home/dave/transfer/website/shell_scripting

cp bottom_file.html /home/dave/transfer/website/shell_scripting

cp top_title.html /home/dave/transfer/website/shell_scripting

cp bottom_title.html /home/dave/transfer/website/shell_scripting


exit 0




Perpetual PC's home page

Perpetual PC's link page