in reply to Re^2: wrapper script to conditionally exec different perls? (#!->#!->#!->...)
in thread wrapper script to conditionally exec different perls?

most kernels don't support having a #! line in a script that points to another script

While this is correct in general, it's maybe worth pointing out that newer versions of the Linux kernel (as of 2.6.27, IIRC) can actually handle this fine (finally!).   I.e., things like these do in fact work:

---  perl-wrapper  ---

#!/usr/bin/perl my $choice = splice @ARGV,1,1; exec '/usr/local/perl/5.14.1/bin/perl', @ARGV if $choice == 14; exec '/usr/local/perl/5.12.3/bin/perl', @ARGV if $choice == 12; exec '/usr/local/perl/5.10.1/bin/perl', @ARGV if $choice == 10; exec '/usr/local/perl/5.8.8/bin/perl', @ARGV;

---  wrap-test.pl  ---

#!/home/eliya/tmp/perl-wrapper print "$] -- @ARGV\n";
$ ./wrap-test.pl 14 foo bar 5.014001 -- foo bar $ ./wrap-test.pl 12 foo bar 5.012003 -- foo bar $ ./wrap-test.pl 10 foo bar 5.010001 -- foo bar $ ./wrap-test.pl 99 foo bar 5.008008 -- foo bar

(the technique to use the first arg as version selector is of course just for demo purposes)

P.S.: side note for anyone playing with this: make sure you have the string "perl" in the shebang line, or else you'll get surprising effects like endless exec loops... — see perlrun for why (search for the word "bizarre").