On 16 Oct 2012, at 18:44, Sven Van Caekenberghe <[email protected]> wrote:

> On 16 Oct 2012, at 18:05, David T. Lewis <[email protected]> wrote:
> 
>> The parameters are not being passed to your VM in the way you expect. Here is
>> what the man page for bash says:
>> 
>>      If  the program is a file beginning with #!, the remainder of the first
>>      line specifies an interpreter for the program.  The shell executes  the
>>      specified interpreter on operating systems that do not handle this exe-
>>      cutable format themselves.  The arguments to the interpreter consist of
>>      a  single optional argument following the interpreter name on the first
>>      line of the program, followed by the name of the program,  followed  by
>>      the command arguments, if any.
>> 
>> I think there is some trick you can use to pass parameters, but I can't
>> recall the details. Maybe google can help.
> 
> Thanks for answering, I will do some more reading then ;-)

David, 

Your tip was the right one: I made my own wrapper script

$ cat pharo

#!/bin/sh
script_home=$(dirname $0)
script_home=$(cd $script_home && pwd)
vm=$script_home/CogVM
options="-vm-display-null -vm-sound-null -plugins $script_home"
$vm $options $*

And now, with just one executable as argument in the header

$ cat header.bin 

#!/home/ubuntu/smalltalk/bin/pharo

It all works

$ ./magic.image eval 'DateAndTime now julianDayNumber'
2456217

$ ./magic.image eval '42 factorial'
1405006117752879898543142606244511569936384000000000

So, the script that is running must do something special with its own arguments.

Thanks again,

Sven

--
Sven Van Caekenberghe
http://stfx.eu
Smalltalk is the Red Pill



Reply via email to