[plt-scheme] scheme unix script that does not terminate

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Jan 12 22:27:39 EST 2010

On Jan 12, YC wrote:
> So is web-server's approach the best way in such case?  Or is there
> actually a way to enter into REPL after the script exits?  Any
> insights are appreciated.

You can use this to run the script and then enter the REPL as usual:

  #!/bin/sh
  #|
  exec mzscheme -it "$0"
  |#
  #lang scheme
  (printf "Hello\n")

which is similar to using:

  exec mzscheme -ie "(require \"$0\")"

If for some reason you want `scheme' to be loaded after the script,
then this

  exec mzscheme -t "$0" -l scheme -i

will work.  (The `-l scheme' is needed because now there will be no
default.)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the users mailing list.