There is no good solution, since different unions process the verbose word #! lines in different ways. Portable #! use constraints for a maximum of one argument to the interpreter on #! string and spaces in the interpreter or argument.
If the language allows this, you can make a script shell script that takes care of loading the interpreter from any command line that it likes. For example, in Perl from the perl manual:
#!/bin/sh -- # -*- perl -*- -p eval 'exec perl -wS "$0" ${1+" $@ "}' if $running_under_some_shell;
The shell stops processing after the second line, and Perl sees lines 2-3 as an instruction that does nothing. Some lisp dialogs / schemas do #! ... !# comment to write
#!/bin/sh exec guile -s "$0" " $@ " !
In general, the only solutions include two files. You can write #!/usr/bin/env mywrapper where mywrapper is a program (it could be a script) that calls the actual interpreter with whatever argument it wants. Or you can make the executable itself a script wrapper and save the interpreted file separately. The second solution has the advantage of working even if the interpreter does not accept the leading line #! .
source share