Ralf Hautkappe wrote:
> the problem is i want my program to be used in a shell script like:
> 
> #!/usr/bin/myprog
> 
> additional forth code
> additional forth code
> ....
> bye
> 
> 
> is there an easy way for beginners to do this?

One way to do this is to have myprog in source, and then start the
script like this:

#! /usr/local/bin/gforth /usr/bin/myprog
...

AFAIK Unix does not allow recursive use of the #! mechanism, so you
either have to do it in one level, as above, or myprog needs to be in
a binary format directly interpreted by the OS.  Currently there is no
easy way to do this for Gforth programs (there is some way to make a C
file from an image, but it is not documented).

One other thing you could do is to write a small C program like this:

int main(int argc, char **argv)
{
  return execlp("gforth",argv[0],"-i","/usr/bin/myprog.fi",argv[1],NULL);
}

(completely untested, and error checking should be added), compile that as
/usr/bin/myprog, and then use your original script.

- anton

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to