|
From: Heiko Z. <he...@zu...> - 2005-11-08 15:47:30
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tue, November 8, 2005 03:16, Serge Leschinsky wrote:
> Dear Heiko,
>
>
>
>> I finally had a chance to look over the code and you're right, it is in
>> 2
>> places. I guess I was blind before. I'd say do to changes the way you
>> proposed it (the bash version).
>
> I've done it in another way. But it is very dirty yet - I haven't had
> time for cleaning (really, I can't write a working "if" with 2 conditions
> (
> logical AND) for some reason, so have to do it by adding return codes :-\
>
>
> while read line do f=`echo $line | cut -d' ' -f1 ` s=`echo $line | cut
- -d' '
> -f2- `
>
>
> # This is the logical AND :-(
> ff=`test "$f" = "$s"` ff=$? ss=`eval test $s` ss=$? sum=`expr $ss + $ff`
>
> if [ "$sum" -le "1" ]; then echo $f fi done < ./perl-ext.1
>
> I haven't investigated yet why something like this
> if [ `test "$f" = "$s"` -a `eval test $s` ]; then doesn't work.
Maybe because $s is not a valid test statement, when $f=$s , since it's
only the name of the perl extension.
What you could do is (very loose syntax):
- ----------------
do_compile=0
if "$f" = "$s"
do_compile=1
else
if `eval test $s`
do_compile=1
fi
fi
if $do_compile = 1
; compile
fi
- ----------------
It looks a bit cleaner and is easier to understand.
- --
Regards
Heiko Zuerker
http://www.devil-linux.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
iD8DBQFDcMiGUcytMSbs+YURAiPGAJ9bWvKS8IPaSQoAZ14WV2HMdgU+dQCgm38n
G5Sv/WWiPvSuRDNFZ9iK/JY=
=erJF
-----END PGP SIGNATURE-----
|