On Sat, Feb 22, 2003 at 09:01:53AM +0900, Atsuhito Kohda wrote:
From: Eugen Dedu <Eugen.Dedu@prism.uvsq.fr>
Subject: Re: Bug#181882: tetex-base: Installation error: "kpsewhich: command not found"
Date: Fri, 21 Feb 2003 17:55:51 +0100
Adding a `-x /usr/bin/kpsewhich' before using it does not solve the
problem, because it seems that ALL the `and' clauses are executed:
eminescu:~$ if [ -x /usr/bin/kpsewhich ]; then echo one; else echo two; fi
two
eminescu:~$ if [ -x /usr/bin/kpsewhich -a X"`kpsewhich
--expand-var='$TEXMFMAIN'`" = X"/usr/share/texmf" ]; then echo one; else
echo two; fi
bash: kpsewhich: command not found
two
eminescu:~$
A check for existence of /usr/bin/kpsewhich should be done probably
before the if.
Hmm, perhaps we need more investigation.
This is the correct solution: shell expands the `...` *before* it
passes the command to '['. So we need to do something like:
if [ -x /usr/bin/kpsewhich ]; then
HAVE_KPSEWHICH=1
else
HAVE_KPSEWHICH=0
fi
if [ $HAVE_KPSEWHICH -eq 1 -a -x ${UPDMAP} -a ... ]; then
....