Re: Mercurial 0.4b vs git patchbomb benchmark

From: Kyle Moffett
Date: Mon May 02 2005 - 16:21:59 EST


On May 2, 2005, at 12:31:06, Linus Torvalds wrote:
That said, I think the /usr/bin/env trick is stupid too. It may be more
portable for various Linux distributions, but if you want _true_
portability, you use /bin/sh, and you do something like

#!/bin/sh
exec perl perlscript.pl "$@"

Oooh, I can one-up that hack with this evil from perlrun(1):

#!/bin/sh -- # -*- perl -*- -W -T
eval 'exec perl -wS $0 ${1+"$@"}'
if 0;
# PERL SCRIPT HERE

Description:
Perl ignores the eval($string) because of the "if 0" in the statement. The
shell sees the statement end at the newline, and executes it faithfully.
The end result is that the preferred Perl gets the script. I don't know
Python, so I don't know if such a trick exists there.

Cheers,
Kyle Moffett

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCM/CS/IT/U d- s++: a18 C++++>$ UB/L/X/*++++(+)>$ P+++(++++)>$
L++++(+++) E W++(+) N+++(++) o? K? w--- O? M++ V? PS+() PE+(-) Y+
PGP+++ t+(+++) 5 X R? tv-(--) b++++(++) DI+ D+ G e->++++$ h!*()>++$ r !y?(-)
------END GEEK CODE BLOCK------



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/