Here's a curiosity:
I have a script (myscript) like so:
#!/usr/local/bin/myprog.pl
# some data
# some more data
The Perl script (myprog.pl) looks like so:
#!/usr/local/bin/perl
print "ARGV = @ARGV\n";
I wish to run myscript from a shell prompt (please don't ask why). What is *supposed* to happen is the first line of the script (myscript) defines what program to execute. It should therefore run myprog.pl (incidentally, with "myscript" as the first parameter), which in turn should execute Perl and feed it the code from myprog.pl.
Doesn't work! No output, no errors, it just returns:
$ myscript
$
If I run "$ myprog.pl hello there", I get the desired output:
ARGV = hello there
-many thanks!
Debugging note:
I wrote a C program functionally identical to myprog.pl, compiled it, and used it in myscript as follows:
#!/usr/local/bin/myprog.exe
# some data
# some more data
This works exactly as desired:
$ myscript
argv[0] = myprog.exe
argv[1] = myscript
$
I have a script (myscript) like so:
#!/usr/local/bin/myprog.pl
# some data
# some more data
The Perl script (myprog.pl) looks like so:
#!/usr/local/bin/perl
print "ARGV = @ARGV\n";
I wish to run myscript from a shell prompt (please don't ask why). What is *supposed* to happen is the first line of the script (myscript) defines what program to execute. It should therefore run myprog.pl (incidentally, with "myscript" as the first parameter), which in turn should execute Perl and feed it the code from myprog.pl.
Doesn't work! No output, no errors, it just returns:
$ myscript
$
If I run "$ myprog.pl hello there", I get the desired output:
ARGV = hello there
-many thanks!
Debugging note:
I wrote a C program functionally identical to myprog.pl, compiled it, and used it in myscript as follows:
#!/usr/local/bin/myprog.exe
# some data
# some more data
This works exactly as desired:
$ myscript
argv[0] = myprog.exe
argv[1] = myscript
$