conditional compilation?

Started by mark5009, March 02, 2017, 08:35:51 PM

Previous topic - Next topic

mark5009

Hi.



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



$ 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