Multiline shebang: Difference between revisions

m
→‎{{header|Phix}}: added p2js compatible version
(→‎{{header|Phix}}: marked p2js incompatible)
m (→‎{{header|Phix}}: added p2js compatible version)
Line 445:
 
=={{header|Phix}}==
<!--(notonline)-->
Obviously this is not pwa/p2js compatible, since you cannot run bash or sed (with redirection) or phix or 'rm tmp.eu' from within a browser, and is only intended to be run on Linux, though you could perhaps run it on Windows but only in some kind of bash shell.
<!--<lang Phix>#!/bin/bash-->
<span style="color: #000000;">#!/bin/bash
sed -n -e '7,$p' < "$0" > tmp.eu
\path\to\phix tmp.eu "$@"
STATUS=$?
rm tmp.eu
exit $STATUS</span>
?command_line()</lang>
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span> <span style="color: #000080;font-style:italic;">-- (not that pwa/p2js would get this far!)</span>
<span style="color: #0000FF;">?</span><span style="color: #7060A8;">command_line</span><span style="color: #0000FF;">()</span>
<!--</lang>-->
Alternatively it was not particularly difficult, just for this task, to add #[ and #] handling, just like /* and */, to both desktop/Phix and pwa/p2js.<br>
Note that I simply cannot see how #! ... !# could ever work, in any programming language, that is while also allowing single line shebangs with no closing !#.<br>
Hence the following (partly based on the Julia entry) now (1.0.2) also works fine, with no detrimental (or beneficial) effect either on (standard) Windows or under pwa/p2js:
<!--<lang Phix>(phixonline)-->
<span style="color: #00000;font-style:italic;">#!/bin/bash
#[
echo Phix ignores all text between #[ and #] in exactly the same way as /* and */
echo (both "and" are nested comments), allowing arbitrary shell code, for example
cd /user/project/working
exec /path/to/phix "$0" "$@"
exit # may be needed for the shell to ignore the rest of this file.
# comments ingored by Phix end here -&gt; #]</span>
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"This is Phix code\n"</span><span style="color: #0000FF;">)</span>
<!--</lang>-->
 
=={{header|PicoLisp}}==
7,820

edits