<?xml version="1.0" encoding="windows-1252"?>
<node id="557403" title="(OT) Re^3: The basics" created="2006-06-24 17:59:13" updated="2006-06-24 13:59:13">
<type id="11">
note</type>
<author id="489671">
Hue-Bond</author>
<data>
<field name="doctext">
&lt;blockquote&gt;&lt;i&gt;To the shell. &amp;#91;...&amp;#93; At least on unixish systems, there is always a shell involved in this process&lt;/i&gt;&lt;/blockquote&gt;
&lt;p&gt;The #! line, also called shebang, tells nothing to any shell. It's the kernel who interprets it. When the first two bytes of an executable file are #!, the kernel runs the command that follows them, with the parameters specified, and feeds it the whole file on its standard input:&lt;/p&gt;
&lt;c&gt;$ cat &gt; a
#!/usr/bin/tail -n2
1
2
3
4
5
6
7
^D
$ chmod +x a
$ ./a
6
7
$ strace ./a 2&gt;&amp;1 | grep -c sh
0&lt;/c&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-489671"&gt;
&lt;p&gt;-- &lt;br /&gt;
David Serrano&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
860</field>
<field name="parent_node">
557400</field>
</data>
</node>
