Page 1 of 1

conditional compilation?

PostPosted: Fri Mar 03, 2017 4:35 am
by mark5009
Hi.

Running under OSX/Unix, I like to first test my code with a #! , then compile them with a -x for use. So,

Code: Select all
$ cat foo.lsp
#! /usr/bin/env newlisp
(println "args -> " (main-args))
(exit)
$ ./foo.lsp bob
args -> ("newlisp" "./foo.lsp" "bob")
$ newlisp -x foo.lsp foo
$ ./foo bob
args -> ("./foo" "bob")


If I want that first arg, it has gone from position 2 to position 1 in the args.

My question is the obvious one: is there a way I can get around this behavior? Use a condition compile flag? Or is there a better solution than editing the file each time I want to compile it?

Thanks in advance .. mark