I have a perl script that execute another script in javascript. To execute the javascript script I type:
Ok, it works. Obviously the jsexec.pl has the shebang #!/usr/bin/perl. To have to type only the javascript script to run it on command line I added a shebang in example.js (and skipped it in perl parser) and chmod a+x example.js. The perl script jsexec.pl is in /root/bin so the shebang is #!/root/bin/jsexec.pl. It doesn't work and strange things happens.
I made two test scripts
Yes, in the javascript script file there is a perl instruction, executing it with
the result is
Searching on google/yahoo found no help.
Code:
# jsexec.pl example.js
I made two test scripts
Code:
[B]Perl script (sbang.pl)[/B]
#!/usr/bin/perl
use strict;
use warnings;
print ("--- sbang.pl ---\n\n");
for (my $i = 0; $i < @ARGV; $i++)
{
my $sParam = $ARGV[$i];
printf (" %04i - %s\n", $i, $sParam);
}
print ("--- end ---\n\n");
Code:
[B]Javascript script (sbang.js)[/B]
#!/root/bin/sbang.pl
printf ("%s %04X", "this is a test", scalar @ARGV);
Yes, in the javascript script file there is a perl instruction, executing it with
Code:
# sbang.js
Code:
Badly placed ()'s.
Searching on google/yahoo found no help.