home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 9
/
FreshFishVol9-CD2.bin
/
bbs
/
gencontents.sh
< prev
next >
Wrap
Linux/UNIX/POSIX Shell Script
|
1995-01-31
|
1KB
|
54 lines
#! /bin/sh
#
tmpd=`date +%j%H%M%S`
tmp1="/tmp/sh1-$tmpd"
tmp2="/tmp/sh2-$tmpd"
tmp3="/tmp/sh3-$tmpd"
egrep "Product-Info$|\.pi$" <$1 >$tmp1
sed <$tmp1 "s:/.*::" | sort | uniq >$tmp2
### Build the root node.
# First copy the CONTENTS-header template...
cat CONTENTS-header
echo "This file tree is organized into several subdirectories. For an"
echo "index of the files in any subdirectory, click on the appropriate"
echo "name below:"
echo ""
for i in `cat $tmp2`
do
# Note - pdksh doesn't properly expand the embedded tab.
/bin/echo "\t@{\"$i\" link $i-INDEX}"
done
# Finish off the root node.
echo "@endnode"
### Now build a node for each of the subdirectories.
for i in `cat $tmp2`
do
echo "@node $i-INDEX \"Index of subdirectory: $i\""
echo ""
echo "For more information about a particular program, click on the name field"
echo "below:"
echo ""
grep "^$i/" <$1 >$tmp3
pitool <$tmp3 -b -F "@{\"%-16.16N\" link %N-%V} %8.8V %-S\n" -f - - | sort -f | uniq
echo "@endnode"
done
### Now build the full contents node for each of the original product
### info files.
pitool <$tmp1 -f - -b -F "@node %N-%V \"%S\"\n\n%N %V %S\n\n%d\n\nAuthor: %a\nPath: %P\n\n@endnode\n\n" -
### All done, clean up.
rm -f $tmp1 $tmp2 $tmp3