2 # file: ~/bin/TeXFiles.sh
3 # all files -> without option
4 # TeX class files -> option cls
5 # TeX style files -> option sty
6 # bibtex style files -> option bst
7 # bibtex database files -> option bib
10 # of kpsewhich and creates a
11 # bstFiles.lst, clsFiles.lst, styFiles.lst, bibFiles.lst
12 # without any parameter all files are created.
14 # Herbert Voss <voss@perce.org>
16 # Updates from Jean-Marc Lasgouttes.
18 # bib support added by Juergen Spitzmueller (v0.3)
20 CLS_STYLEFILE=clsFiles.lst
21 STY_STYLEFILE=styFiles.lst
22 BST_STYLEFILE=bstFiles.lst
23 BIB_FILES=bibFiles.lst
24 version='$Id: TeXFiles.sh,v 0.3 2003-02-14'
25 progname=`echo $0 | sed 's%.*/%%'`
26 usage="Usage: TeXFiles.sh [-version | cls | sty | bst | bib ]
27 Default is without any Parameters,
28 so that all files will be created"
31 test -z "$types" && types="cls sty bst bib"
34 # MS-DOS and MS-Windows define $COMSPEC or $ComSpec and use ';' to separate
35 # directories in path lists whereas Unixes uses ':'.
36 # $SEP holds the right character to be used by the scripts.
39 # never used this one with windows and what happens with mac??
42 if test -z "$COMSPEC" && test -z "$ComSpec"; then SEP=':'; else SEP=';'; fi
45 # A copy of some stuff from mktex.opt, so we can run in the presence of
46 # terminally damaged ls-R files.
48 if test "x$1" = x--help || test "x$1" = x-help; then
51 elif test "x$1" = x--version || test "x$1" = x-version; then
52 echo "`basename $0` $version"
57 for type in $types ; do
58 echo "Indexing files of type $type"
60 cls) outfile=$CLS_STYLEFILE
62 sty) outfile=$STY_STYLEFILE
64 bst) outfile=$BST_STYLEFILE
66 bib) outfile=$BIB_FILES
68 *) echo "ERROR: unknown type $type"
75 dirs=`kpsewhich --show-path=$kpsetype 2>/dev/null | tr "$SEP" " " | sed -e 's%///%/%' -e 's%//%/%g' -e 's%!!%%g'`
78 find $dir -follow -name "*.$type" >>$outfile 2>/dev/null
82 #echo "list saved in $STYLEFILE"
83 #echo `wc -l $CLS_STYLEFILE` # only for information
85 # this is the end my friends ... Jim Morrison and the Doors in "The End"