[tex-live] [for TL bugs page] wordcount.sh is misplaced
gnwiii at gmail.com
gnwiii at gmail.com
Sun Jul 9 14:03:02 CEST 2006
On 7/7/06, Karl Berry <karl at freefriends.org> wrote:
> Back on this msg from April.
>
> As far as I can see the shell script wordcount.sh is placed under
> source/wordcount and should be placed somewhere more apropriate, (under
> bin?)
>
> I guess I am tempted to do nothing, after all. It is just so painful to
> deal with adding stuff in the bin directories, and I thought that anyone
> who actually wanted it would find it in source. And the script is six
> years old and you're the first person to say anything about it.
Hmmm. I haven't need to count words for over 10 years. The problem
with tools that aren't readily useable is that nobody else uses them,
so when it _is_ needed it isn't likely to work.
> ... None of which are good reasons, I know. The method does seem
> fairly clever :).
And does something that isn't easy to do with the tools at hand.
Why not put wordcount.sh in the texmfscripts directory like the .pl
and .rb scripts?
For unix/linux a simple wrapper script (based on the texexec script
from tetex, which has the ugly portability hacks needed to run on
those 1-of-a-kind legacy unix variants ) can find it with
kpsewhich and pass it to appropriate shell. If any cares to install
sh.exe on Win32 they can
use something like irun to make a .exe equivalent. The advantage of
this is that the bin files don't have to be updated every time the
scripts are changed, for example:
------------------------------------ runtexmfsh --------------------
#!/bin/sh
# runtexmfsh -- run .sh script via "kpsewhich -format=texmfscripts"
# Portability: most unix/linux systems with /bin/sh
# to install, e.g., wordcount
# copy wordcount.sh to a texmf/scripts directory and run "ln -s
runtexmfsh wordcount"
# in the texlive "bin/<arch>" directory
# History:
# based on teTeX-3.0 texexec script, probably last revised by Thomas Esser
# License:
# Changes by George N. White III, 9 July, 2006 are in the public domain
# to run wordcount.sh, replace .pl with .sh and change name to "runtexmsh"
test -f /bin/sh5 && test -z "$RUNNING_SH5" \
&& { UNAMES=`uname -s`; test "x$UNAMES" = xULTRIX; } 2>/dev/null \
&& { RUNNING_SH5=true; export RUNNING_SH5; exec /bin/sh5 $0 ${1+"$@"}; }
unset RUNNING_SH5
test -f /bin/bsh && test -z "$RUNNING_BSH" \
&& { UNAMES=`uname -s`; test "x$UNAMES" = xAIX; } 2>/dev/null \
&& { RUNNING_BSH=true; export RUNNING_BSH; exec /bin/bsh $0 ${1+"$@"}; }
unset RUNNING_BSH
# hack around a bug in zsh:
test -n "${ZSH_VERSION+set}" && alias -g '${1+"$@"}'='"$@"'
what=`echo $0 | sed 's at .*/@@'`
p=`kpsewhich -format=texmfscripts $what.sh`
{ test -n "$p" && test -f "$p"; } \
|| { echo "\`$what.sh' not found."; exit 1; }
exec /bin/sh "$p" ${1+"$@"}
----------------------------- end of runtexmfsh
----------------------------------------------
I suppose we could have one "runtexmfscripts" or "runtexmfany" that
tries .rb, .pl, .jar, .sh ...
ConTeXt's .rb scripts should be run with something like "ruby
texmfstart.rb $what... ",
which is OK as long as nobody decides to do a wordcount.rb. I use
"runtexmjar" for JabRef.jar.
Setup:
1) copy wordcount.sh to texmf-local/scripts/wordcount/wordcount.sh
2) mktexlsr <tex live path>/tex-local
3) in the bin/i386-linux directory: ln -s runtexmfsh wordcount
4) try it out:
$ wordcount sample2e
This is pdfTeXk, Version 3.141592-1.40.0-beta-20060213 (Web2C 7.5.5)
\write18 enabled.
%&-line parsing enabled.
entering extended mode
(/mnt/hdb/opt/tex/texlive/2005/texmf-dist/tex/latex/wordcount/wordcount.tex
LaTeX2e <2003/12/01>
Babel <v3.8g> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, basque, french, ukenglish, loaded.
(/mnt/hdb/opt/tex/texlive/2005/texmf-dist/tex/latex/base/fontenc.sty
(/mnt/hdb/opt/tex/texlive/2005/texmf-dist/tex/latex/base/t1enc.def))
No auxiliary output files.
File name [press RETURN to cancel]: sample2e
Processing sample2e...
sample2e contains 4253 characters and 783 words.
--
George N. White III <aa056 at chebucto.ns.ca>
Head of St. Margarets Bay, Nova Scotia
More information about the tex-live
mailing list