Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a "script file" as the script interpreter (#!...)

Status
Not open for further replies.

msc0tt

IS-IT--Management
Jun 25, 2002
281
CA
The script interpreter (as defined on the first line of a script with the shebang "#!"), is typically a binary, such as 'sh' or 'perl'. I have a need to use a Perl script as the script interpreter. For example, my script (test.msi) would look like this:
#!/usr/local/bin/myScriptInterpreter.pl
# some data
# some more data

My script interpreter (myScriptInterpreter.pl) might look like this:
#!/usr/local/bin/perl
print "This is a test\n";

If I were to run "./test.msi", it should launch myScriptInterpreter.pl, and print "This is a test". It doesn't. No errors, no output. It just comes back.

Is there a way for SCO 5.0.5 to do this??
-with thanks
 
It seems that the version of exec used to run the script interpreter doesn't look for the #! a second time.

You can provide one other parameter to the interpreter though, so a work-around would be to specify:

[tt]#!/usr/local/bin/perl /usr/local/bin/myInterpreter.pl[/tt]

...at the beginning of test.msi. Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top