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
9 # of kpsewhich and creates a
10 # bstFiles.lst, clsFiles.lst, styFiles.lst
11 # without any parameter all files are created.
13 # Herbert Voss <voss@perce.org>
15 CLS_STYLEFILE=clsFiles.lst
16 STY_STYLEFILE=styFiles.lst
17 BST_STYLEFILE=bstFiles.lst
18 version='$Id: TeXFiles.sh,v 0.1 2001-10-01'
19 progname=`echo $0 | sed 's%.*/%%'`
21 usage="Usage: TeXFiles.sh [-version | cls | sty | bst]
22 Default is without any Parameters,
23 so that all files will be created"
26 # MS-DOS and MS-Windows define $COMSPEC or $ComSpec and use ';' to separate
27 # directories in path lists whereas Unixes uses ':'.
28 # $SEP holds the right character to be used by the scripts.
31 # never used this one with windows and what happens with mac??
34 if test -z "$COMSPEC" && test -z "$ComSpec"; then SEP=':'; else SEP=';'; fi
36 # Add the location of the script to the PATH if necessary. This must
37 # be done before kpsewhich can be called, and thus cannot be put into
40 dirname=`echo $0 | sed 's%/*[^/][^/]*$%%'`
41 echo "Actual Dir: $dirname"
42 case $dirname in # $dirname correct?
45 /* | [A-z]:/*) # / -> Absolute name
46 PATH="$dirname$SEP$PATH" ;;
47 *) # other -> Relative name
48 PATH="`pwd`/$dirname$SEP$PATH" ;;
51 # A copy of some stuff from mktex.opt, so we can run in the presence of
52 # terminally damaged ls-R files.
54 if test "x$1" = x--help || test "x$1" = x-help; then
57 elif test "x$1" = x--version || test "x$1" = x-version; then
58 echo "`basename $0` $version"
63 # find the directories with kpsewhich. TeX has files ls-R to hold
67 OIFS=$IFS; IFS=$SEP; set x `kpsewhich --show-path=ls-R 2>/dev/null`; shift; IFS=$OIFS
69 echo 'Delete old *files.lst, if present'
73 touch $CLS_STYLEFILE # create new file
77 touch $STY_STYLEFILE # create new file
81 touch $BST_STYLEFILE # create new file
84 rm -f $CLS_STYLEFILE $STY_STYLEFILE $BST_STYLEFILE
85 touch $CLS_STYLEFILE $STY_STYLEFILE $BST_STYLEFILE
88 echo "looking for all bst-style files in the latex tree";
89 for TEXMFLSR in "$@"; do # go through the dirs
90 case "$TEXMFLSR" in # Prepend cwd if the directory was relative.
91 "") continue ;; # it is an error if this case is taken.
92 /* | [A-z]:/*) ;; # leading /
93 *) TEXMFLSR="`pwd`/$TEXMFLS_R" # all other
95 echo "Dir: <$TEXMFLSR>"
96 case "$1" in # list all files with suffix bst
98 find $TEXMFLSR -name *.cls >> $CLS_STYLEFILE
101 find $TEXMFLSR -name *.sty >> $STY_STYLEFILE
104 find $TEXMFLSR -name *.bst >> $BST_STYLEFILE
107 find $TEXMFLSR -name *.cls >> $CLS_STYLEFILE
108 find $TEXMFLSR -name *.sty >> $STY_STYLEFILE
109 find $TEXMFLSR -name *.bst >> $BST_STYLEFILE
115 #echo "list saved in $STYLEFILE"
116 #echo `wc -l $CLS_STYLEFILE` # only for information
118 # this is the end my friends ... Jim Morrison and the Doors in "The End"