Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #----------------------------------------------\
- #Christopher Nulph | Assignment 2C | Oct 6 2010|
- #----------------------------------------------|
- #Builds a 6x6 table where the first 6 chars of |
- #the strings entered are the labels and the |
- #script checks words that begin with i and end |
- #with j. |
- #**********************************************|
- #Note: Bash is not freezing when executed, it |
- # simply takes some time to manuver in |
- # the wordlist. |
- # |
- # granite.sru.edu/~crn5346/table.html |
- #----------------------------------------------/
- #Redirect all output of this script to table.html
- exec 1>/homes/crn5346/public_html/table.html
- name="$1$2"
- tablelabels=`echo $name|cut -c 1-6|more`
- echo "<table border='1'><TR><td> </td>"
- i=1
- while [ $i -le 6 ] #Table Header Row
- do
- echo "<td>"`echo $name|cut -c $i|more`"</td>"
- i=$((i+1))
- done
- echo "</tr>"
- j=1
- i=1
- dict=/usr/share/dict/words
- while [ $j -le 6 ] #Rows with letter
- do
- echo "<tr><td>"`echo $name|cut -c $j|more`"</td>"
- while [ $i -le 6 ] #Content of each row from words file.
- do
- col=`echo $name|cut -c $i|more` #ith letter
- row=`echo $name|cut -c $j|more` #jth letter
- echo "<td>"`grep -c -e ^$col.*$row$ $dict` "</td>"
- i=$((i+1))
- done
- echo "</tr>"
- i=1
- j=$((j+1))
- done
- echo "</table>"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement