document files

Mats Nygren nygren at
Wed Sep 6 19:09:36 UTC 2000

Ian Piumarta <Ian.Piumarta at> wrote:
>               #!/usr/local/bin/squeak --
>               Transcript cr; show: 'Hello, world'.
>        and then made executable with
>               chmod +x hello.sq
>        and then invoked by running the script file directly:
>               SQUEAK_IMAGE="foo.image"
>               export SQUEAK_IMAGE
>               ./hello.sq

Why do you prefer the above to:

  #!/usr/local/bin/squeak foo.image
  Transcript cr; show: 'Hello, world'.

which collects all info in one place?

> > And I'll also appreciate if you spell out the details of how to make an
> > image with the #! in the beginning, is there a handy way to get it into
> > the image from inside Squeak?
> This isn't as straightforward as it sounds, since there are (or at
> least there were) two kinds of images floating around: those that have
> a 512-byte remnant (left over from their days as HFS files) before the
> real data, and those that potentially don't.  If you've got an image
> that doesn't then I don't recommend trying to add an interpreter line
> to the front of it.
> You could pretty easily write some Squeak to find out if the header is
> there or not by looking in the image loading code (which skips over
> the header, if it finds one).
> For images that have the header, it's pretty easy to add the
> interpreter line in Squeak.  After saving the image: open it as an old
> binary file, dump
> 	#!<full-path-to-vm> <any-`-<option>'s-you-like> <Character cr> "lf>"
> in the beginning, then close it.  You can get at <full-path-to-vm>
> through one of the system attributes.[1]

I was thinking about introducing a new primitive (setHeader: getHeader)
to inform the VM about a 512-byte-maximum header for the image. So
one can collect it all into one place, using images as exacutables. If that
string is non-nil non-'' then make the header at the next save. How
about that?

One might also consider always having the 512 bytes. I have yet
to see an imagesize below 1M, making it below 0.5 promille wasted space when

Thanks for the patch and the "FM". I have missed this functionality for
some time. Some polishing, the OSProcess, regular expressions and (for
me) a whole new way of dealing with Unix.


More information about the Squeak-dev mailing list