<br><br><div class="gmail_quote">On Sat, Oct 9, 2010 at 10:54 AM, Chris Muller <span dir="ltr">&lt;<a href="mailto:asqueaker@gmail.com">asqueaker@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hm, it looks like you are right.  When I pass the argument directly to squeak:<br>
<br>
  squeak my.image my.script &#39;hello world&#39; &amp;<br>
<br>
and &#39;hello world&#39; came in as a single-argument.  So I&#39;ve got some bashing to do.<br></blockquote><div><br></div><div>You need to use &quot;$@&quot;, not $@, $* or &quot;$*&quot;.  See the squeak scripts in the Cog linux VM for an example.</div>
<div><br></div><div><div>#!/bin/sh</div><div>BIN=`/usr/bin/dirname $0`/lib/squeak/3.9-7</div><div># At least on linux LD_LIBRARY_PATH&#39;s components must be absolute path names</div><div>case &quot;$BIN&quot; in</div><div>
/*) PLUGINS=&quot;$BIN&quot;;;</div><div>*) PLUGINS=&quot;`pwd`/$BIN&quot;</div><div>esac</div><div># prepending is less flexible but safer because it ensures we find the plugins</div><div># in the same directory as the VM.</div>
<div>LD_LIBRARY_PATH=$PLUGINS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} exec &quot;$BIN/squeak&quot; &quot;$@&quot;</div></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<br>
Thanks, and sorry for the false alarm.<br>
<br>
 - Chris<br>
<br>
PS - is there a Linux &quot;best practice&quot; or overall preference regarding<br>
command-line arguments vs. stdin?  stdin would allow redirection of<br>
Smalltalk scripts, as well as the convenience of raw stream input via<br>
the keyboard (e.g., not having to worry about escape chars), so I&#39;m<br>
leaning that way...<br></blockquote><div><br></div><div>Since Squeak hasn&#39;t been used that much with stdio I would expect there not to be any best practices.  Instead you should just go ahead and explore.  I think the point of using stdin is that it allows interactive experimentation.  In developing a bootstrap from a kernel image tis will have its uses.  Being able to write pipelined commands in Squeak is fun but arguably one needs a much better file interface to make this compelling.  </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5"><br>
<br>
On Fri, Oct 8, 2010 at 4:10 PM, Bert Freudenberg &lt;<a href="mailto:bert@freudenbergs.de">bert@freudenbergs.de</a>&gt; wrote:<br>
&gt; Squeak does it right. I suspect your &quot;st&quot; script is broken.<br>
&gt;<br>
&gt; - Bert -<br>
&gt;<br>
&gt;<br>
&gt; On 08.10.2010, at 09:44, Chris Muller wrote:<br>
&gt;<br>
&gt;&gt;&gt; Of course.  Try it and see.  This is a shell issue.  What&#39;s the syntax to<br>
&gt;&gt;&gt; supply an arg containing spaces.  On Unix there are<br>
&gt;&gt;&gt; two^H^H^Hthree^H^H^H^H^Hfour ways.  Escape spaces with back slashes, use IFS<br>
&gt;&gt;&gt; to make space a non-separator and separate words using e.g. TAB (I think<br>
&gt;&gt;&gt; this works), surround the argument with single quotes or surround the arg<br>
&gt;&gt;&gt; with double quotes.<br>
&gt;&gt;<br>
&gt;&gt; Right I did try all of those things of course (except adjusting IFS),<br>
&gt;&gt; but it appears that Squeak puts its own interpretation onto these<br>
&gt;&gt; arguments differently from the shell.  IOW, Squeak appears to be doing<br>
&gt;&gt; a simple subStrings operation regardless of escape-characters when<br>
&gt;&gt; loading up the systemAttribute array...  For example:<br>
&gt;&gt;<br>
&gt;&gt;  st &#39;1000 factorial&#39;    &lt;----- Squeak gets 2 args, &#39;1000&#39; and &#39;factorial&#39;<br>
&gt;&gt;  st &quot;1000\ factorial&quot;    &lt;----- Squeak gets 2 args, &#39;1000\&#39; and &#39;factorial&#39;<br>
&gt;&gt;<br>
&gt;&gt; Strings are a challenge because the shell does not allow single-ticks<br>
&gt;&gt; inside of single-ticks, but one can use Symbols:<br>
&gt;&gt;<br>
&gt;&gt;  st &#39;#hello asString asUppercase&#39;   &lt;--------- Squeak gets 3 args...<br>
&gt;&gt;<br>
&gt;&gt; My goal is to deliver a &quot;Smalltalk command-line&quot;.  I did find that<br>
&gt;&gt; your stdin works, so I can do:<br>
&gt;&gt;<br>
&gt;&gt;  st &lt;&lt;printit<br>
&gt;&gt; &#39;hello&#39; asUppercase<br>
&gt;&gt; printit<br>
&gt;&gt;<br>
&gt;&gt; works.  :)<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; I actually want to allow the Linux user to specify a chunk of code<br>
&gt;&gt;&gt;&gt; (which contains spaces) on the command-line.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; I tried enclosing it in ticks, but Squeak still loaded each<br>
&gt;&gt;&gt;&gt; system-attribute into its own slot.  Interestingly, it did not include<br>
&gt;&gt;&gt;&gt; the beginning or ending tick.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; So, it looks like I could assemble all of the pieces, separatedBy:<br>
&gt;&gt;&gt;&gt; Character space, but that would limit the chunk to 997 &quot;words&quot;..<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
<br>
</div></div></blockquote></div><br>