<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Wrapping dynamic languages in shell without an extra script</title>
	<atom:link href="http://bashcurescancer.com/wrapping-dynamic-languages-in-shell-without-an-extra-script.html/feed" rel="self" type="application/rss+xml" />
	<link>http://bashcurescancer.com/wrapping-dynamic-languages-in-shell-without-an-extra-script.html</link>
	<description>Learn the UNIX/Linux command line</description>
	<lastBuildDate>Mon, 06 Jun 2011 01:35:32 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Anonymous</title>
		<link>http://bashcurescancer.com/wrapping-dynamic-languages-in-shell-without-an-extra-script.html/comment-page-1#comment-20935</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Thu, 21 Aug 2008 20:27:29 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/wrapping-dynamic-languages-in-shell-without-an-extra-script.html#comment-20935</guid>
		<description>You *don&#039;t* want to use &lt;&lt;END_OF_PYTHON, because that doesn&#039;t quote the here document, so variables get interpreted.  For instance, if your python code contains $foo anywhere, bash will replace it with the value of the environment variable $foo.  You want to use &lt;&lt;&#039;END_OF_PYTHON&#039;, which quotes the here document.</description>
		<content:encoded><![CDATA[<p>You *don&#8217;t* want to use &lt;&lt;END_OF_PYTHON, because that doesn&#8217;t quote the here document, so variables get interpreted.  For instance, if your python code contains $foo anywhere, bash will replace it with the value of the environment variable $foo.  You want to use &lt;&lt;&#8217;END_OF_PYTHON&#8217;, which quotes the here document.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brock Noland</title>
		<link>http://bashcurescancer.com/wrapping-dynamic-languages-in-shell-without-an-extra-script.html/comment-page-1#comment-5297</link>
		<dc:creator>Brock Noland</dc:creator>
		<pubDate>Thu, 27 Mar 2008 14:54:53 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/wrapping-dynamic-languages-in-shell-without-an-extra-script.html#comment-5297</guid>
		<description>@Paddy3118,

&gt; although how do you add extra command line options?

&lt;pre&gt;
$ ./python-and-bash-with-options.sh
[&#039;ARG!&#039;]
noland@swat:~$ cat python-and-bash-with-options.sh
#!/bin/bash
/usr/bin/python - &#039;ARG!&#039;&lt;&lt;END_OF_PYTHON
import sys
print sys.argv[1:]
END_OF_PYTHON
$ ./python-and-bash-with-options.sh
[&#039;ARG!&#039;]
&lt;/pre&gt;

@dubek,

That&#039;s a novel idea and I think it would work if env supported it, whether variables are expanded or not.

&gt; I’m not sure that variable substitution would have worked inside the shebang line, even if we solve somehow problem

If &lt;a href=&quot;http://bashcurescancer.com/on-the-case-of-carriage-returns-and-kernel-exec-function-calls.html&quot; rel=&quot;nofollow&quot;&gt;I remember correctly&lt;/a&gt;, that entire line gets passed into the kernel.

I am going to look at this some more.
Brock</description>
		<content:encoded><![CDATA[<p>@Paddy3118,</p>
<p>> although how do you add extra command line options?</p>
<pre>
$ ./python-and-bash-with-options.sh
['ARG!']
noland@swat:~$ cat python-and-bash-with-options.sh
#!/bin/bash
/usr/bin/python - 'ARG!'< <END_OF_PYTHON
import sys
print sys.argv[1:]
END_OF_PYTHON
$ ./python-and-bash-with-options.sh
['ARG!']
</pre>
<p>@dubek,</p>
<p>That's a novel idea and I think it would work if env supported it, whether variables are expanded or not.</p>
<p>> I’m not sure that variable substitution would have worked inside the shebang line, even if we solve somehow problem</p>
<p>If <a href="http://bashcurescancer.com/on-the-case-of-carriage-returns-and-kernel-exec-function-calls.html" rel="nofollow">I remember correctly</a>, that entire line gets passed into the kernel.</p>
<p>I am going to look at this some more.<br />
Brock</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: dubek</title>
		<link>http://bashcurescancer.com/wrapping-dynamic-languages-in-shell-without-an-extra-script.html/comment-page-1#comment-5292</link>
		<dc:creator>dubek</dc:creator>
		<pubDate>Thu, 27 Mar 2008 11:45:12 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/wrapping-dynamic-languages-in-shell-without-an-extra-script.html#comment-5292</guid>
		<description>I had an another idea of using a shebang line like the following:


#!/usr/bin/env LD_LIBRARY_PATH=/home/noland/oracle-lib:$LD_LIBRARY_PATH /usr/bin/python


But it doesn&#039;t work, because: 

a. shebang lines are seperated into TWO (and only two) arguments -- 
1. the program to run (/usr/bin/env) 
2. the rest of the line, given as a single argument the to program. 
So in this case, the shell (or whomever is dealing with these shebang lines, I think you wrote on that once) tries to find a command named &quot;LD_LIBRARY_PATH=/home/noland/oracle-lib:$LD_LIBRARY_PATH /usr/bin/python&quot;, which doesn&#039;t exist.


b. I&#039;m not sure that variable substitution would have worked inside the shebang line, even if we solve somehow problem a. If you need to add something to an existing environment variable, you must have variable substitution, I guess.</description>
		<content:encoded><![CDATA[<p>I had an another idea of using a shebang line like the following:</p>
<p>#!/usr/bin/env LD_LIBRARY_PATH=/home/noland/oracle-lib:$LD_LIBRARY_PATH /usr/bin/python</p>
<p>But it doesn&#8217;t work, because: </p>
<p>a. shebang lines are seperated into TWO (and only two) arguments &#8212;<br />
1. the program to run (/usr/bin/env)<br />
2. the rest of the line, given as a single argument the to program.<br />
So in this case, the shell (or whomever is dealing with these shebang lines, I think you wrote on that once) tries to find a command named &#8220;LD_LIBRARY_PATH=/home/noland/oracle-lib:$LD_LIBRARY_PATH /usr/bin/python&#8221;, which doesn&#8217;t exist.</p>
<p>b. I&#8217;m not sure that variable substitution would have worked inside the shebang line, even if we solve somehow problem a. If you need to add something to an existing environment variable, you must have variable substitution, I guess.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paddy3118</title>
		<link>http://bashcurescancer.com/wrapping-dynamic-languages-in-shell-without-an-extra-script.html/comment-page-1#comment-5191</link>
		<dc:creator>Paddy3118</dc:creator>
		<pubDate>Wed, 26 Mar 2008 07:54:56 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/wrapping-dynamic-languages-in-shell-without-an-extra-script.html#comment-5191</guid>
		<description>Hmmm,
I never thought of that.

Instead I used bashes multiline single quoted string feature to wrap my python source that I used double quoted strings in:

  Python -c &#039;
    # python &quot;source&quot; &quot;&quot;&quot;here&quot;&quot;&quot;
  &#039; 

Your way seems better, although how do you add extra command line options?

- Paddy.</description>
		<content:encoded><![CDATA[<p>Hmmm,<br />
I never thought of that.</p>
<p>Instead I used bashes multiline single quoted string feature to wrap my python source that I used double quoted strings in:</p>
<p>  Python -c &#8216;<br />
    # python &#8220;source&#8221; &#8220;&#8221;"here&#8221;"&#8221;<br />
  &#8216; </p>
<p>Your way seems better, although how do you add extra command line options?</p>
<p>- Paddy.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.200 seconds -->

