* beta 19 cannot run this script
@ 1996-06-05 16:59 Carlos Carvalho
1996-06-05 16:03 ` Bart Schaefer
0 siblings, 1 reply; 6+ messages in thread
From: Carlos Carvalho @ 1996-06-05 16:59 UTC (permalink / raw)
To: zsh-workers
I had to link /bin/sh to zsh in order to make automatic tex font
generation work. However, zsh (called as sh), doesn't run this script:
#! /bin/sh
# apsfilter 4.9
# by Andreas Klemm
# Mon Feb 6 19:54:12 MET 1995
SUPPORTED_FILTERS="\
gs \
dvips \
a2ps \
ras2ps \
giftoppm \
pnmtops \
ppmtopgm \
fig2dev \
rasttopnm \
tifftopnm \
gzip \
compress \
pack \
djpeg \
melt \
"
# are we called by SETUP or are we standalone ?
# if standalone, then grab APS_BASEDIR from /etc/printcap file
if [ ! $APS_BASEDIR ]; then
APS_BASEDIR=`grep APS_BASEDIR /etc/printcap | cut -d ':' -f 2`
export APS_BASEDIR
fi
. $APS_BASEDIR/global/GLOBAL.sh
echo "cleaning global config file..."
if [ -f $FILTERS_FOUND ]; then
: > $FILTERS_FOUND
fi
# extract searchpatch for find from PATH
SEARCHPATH=`echo $PATH | sed -e "s/:/\ /g"`
echo "looking for available filter programs on this system..."
for filter in $SUPPORTED_FILTERS
do
FILTER=`echo $filter | tr 'a-z' 'A-Z'`
for path in $SEARCHPATH
do
if [ -f $path/$filter ]
then
set HAVE_$FILTER="True" \
&& echo "found filter $filter" \
&& echo "HAVE_$FILTER=True" >> $FILTERS_FOUND
fi
done
done
if [ -f $FILTERS_FOUND ]; then
sort < $FILTERS_FOUND | uniq > /tmp/apsfilterrc.$$
mv /tmp/apsfilterrc.$$ $FILTERS_FOUND
else
# a system without special filter
echo "# no supported filters found during filtersetup ?!" >> $FILTERS_FOUND
echo "# if you suppose to add filters like dvips, gs,..." >> $FILTERS_FOUND
echo "# later, then run $APS_BASEDIR/setup/filtersetup " >> $FILTERS_FOUND
echo "# again ! " >> $FILTERS_FOUND
# mail the poor result !!!
cat $FILTERS_FOUND | $MAIL root > /dev/null 2>&1
fi
The error is:
./filtersetup: [: argument expected [40]
/global/GLOBAL.sh: .: no such file or directory: /global/GLOBAL.sh [45]
cleaning global config file...
./filtersetup: [: argument expected [49]
looking for available filter programs on this system...
found filter gs
./filtersetup: no such file or directory: [66]
./filtersetup: [: argument expected [71]
Carlos
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: beta 19 cannot run this script
1996-06-05 16:59 beta 19 cannot run this script Carlos Carvalho
@ 1996-06-05 16:03 ` Bart Schaefer
1996-06-05 19:31 ` Carlos Carvalho
0 siblings, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 1996-06-05 16:03 UTC (permalink / raw)
To: Carlos Carvalho, zsh-workers
On Jun 5, 11:59am, Carlos Carvalho wrote:
} Subject: beta 19 cannot run this script
}
} I had to link /bin/sh to zsh in order to make automatic tex font
} generation work. However, zsh (called as sh), doesn't run this script:
This seems to be the problem:
======
bash:
$ [ ! ] && echo OK
OK
======
True Bourne shell:
$ [ ! ] && echo OK
[: argument expected
======
zsh:
% [ ! ] && echo OK
[: argument expected
======
So I think zsh is OK in this case.
Here's the culprit in the script:
if [ ! $APS_BASEDIR ]; then
This isn't a very portable script in the first place. A better test for
a variable being unset would be:
if [ -z "$APS_BASEDIR" ]; then
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.nbn.com/people/lantern
New male in /home/schaefer:
>N 2 Justin William Schaefer Sat May 11 03:43 53/4040 "Happy Birthday"
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: beta 19 cannot run this script
1996-06-05 16:03 ` Bart Schaefer
@ 1996-06-05 19:31 ` Carlos Carvalho
1996-06-05 18:11 ` Mike Kazda
0 siblings, 1 reply; 6+ messages in thread
From: Carlos Carvalho @ 1996-06-05 19:31 UTC (permalink / raw)
To: schaefer; +Cc: zsh-workers
Bart Schaefer (schaefer@candle.brasslantern.com) wrote on 5 June 1996 09:03:
>On Jun 5, 11:59am, Carlos Carvalho wrote:
>} Subject: beta 19 cannot run this script
>}
>} I had to link /bin/sh to zsh in order to make automatic tex font
>} generation work. However, zsh (called as sh), doesn't run this script:
>
>This seems to be the problem:
>
>======
>bash:
>
>$ [ ! ] && echo OK
>OK
>======
>True Bourne shell:
>
>$ [ ! ] && echo OK
>[: argument expected
>======
>zsh:
>
>% [ ! ] && echo OK
>[: argument expected
>======
>
>So I think zsh is OK in this case.
Hmmm...
>Here's the culprit in the script:
>
> if [ ! $APS_BASEDIR ]; then
>
>This isn't a very portable script in the first place. A better test for
>a variable being unset would be:
>
>
> if [ -z "$APS_BASEDIR" ]; then
I tried this and it doesn't work :-(
Trying with this small version:
#! /bin/sh
if [ -z $APS_BASEDIR ]; then
APS_BASEDIR=`grep APS_BASEDIR /etc/printcap | cut -d ':' -f 2`
export APS_BASEDIR
fi
I get
./foo: [: argument expected [2]
So there seems to be something wrong...
Carlos
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: beta 19 cannot run this script
1996-06-05 19:31 ` Carlos Carvalho
@ 1996-06-05 18:11 ` Mike Kazda
1996-06-05 21:11 ` SOLVED: " Carlos Carvalho
0 siblings, 1 reply; 6+ messages in thread
From: Mike Kazda @ 1996-06-05 18:11 UTC (permalink / raw)
To: Carlos Carvalho; +Cc: zsh-workers
>>>>> "Carlos" == Carlos Carvalho <carlos@riglos.fisica.ufpr.br> writes:
>>
>> if [ -z "$APS_BASEDIR" ]; then
Carlos> I tried this and it doesn't work :-(
Carlos> Trying with this small version:
#! /bin/sh
if [ -z $APS_BASEDIR ]; then
APS_BASEDIR=`grep APS_BASEDIR /etc/printcap | cut -d ':' -f 2`
export APS_BASEDIR
fi
You need to double quote variable otherwise the shell will just
evaluate it and there is no argument as indicated by the shell. I
think that bash is just a quirk that it works. Normally, ksh, regular
sh, this will fail, unless you double quote it.
#! /bin/sh
if [ -z "$APS_BASEDIR" ]; then
APS_BASEDIR=`grep APS_BASEDIR /etc/printcap | cut -d ':' -f 2`
export APS_BASEDIR
fi
Mike
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: beta 19 cannot run this script
@ 1996-06-05 18:00 Eskandar Ensafi
0 siblings, 0 replies; 6+ messages in thread
From: Eskandar Ensafi @ 1996-06-05 18:00 UTC (permalink / raw)
To: zsh-workers, Carlos Carvalho
Hello,
On Wed, 05 Jun 1996 14:31:00 EST, Carlos Carvalho wrote:
> I tried this and it doesn't work :-(
You didn't do exactly what Bart suggested!
You must put double quotes around "$APS_BASEDIR" to force [ -z ... ] to
see a null argument. Without double quotes, [ -z ... ] might not see an
argument if the variable is empty or undefined!
The difference is that when $APS_BASEDIR is empty or undefined, the test
[ -z $APS_BASEDIR ] becomes [ -z ], which makes no sense, but written as
[ -z "$APS_BASEDIR" ], it becomes [ -z "" ], which makes perfect sense.
If you don't want to fuss with quotes, then you can write your script in
ksh syntax using [[ ... ]] instead of [ ... ]. This test syntax is fully
supported in zsh, but you will lose compatibility with /bin/sh. Simply
say [[ -z $APS_BASEDIR ]] -- the advantage of [[ ... ]] is that undefined
and empty variables will be treated as null arguments.
Later,
Eskandar
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1996-06-05 19:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-06-05 16:59 beta 19 cannot run this script Carlos Carvalho
1996-06-05 16:03 ` Bart Schaefer
1996-06-05 19:31 ` Carlos Carvalho
1996-06-05 18:11 ` Mike Kazda
1996-06-05 21:11 ` SOLVED: " Carlos Carvalho
1996-06-05 18:00 Eskandar Ensafi
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).