Bug in command-line option (-w)

Started by kanen, May 03, 2011, 12:36:16 PM

Previous topic - Next topic

kanen

I should be able to specify command-line options to be used with (main-args)
$ newlisp -word hi

ERR: no working directory found


This is a problem, because I did not specify "-w <working directory>" -- even though newLisp believes I did.



Maybe check for a space after -w?
. Kanen Flowers http://kanen.me[/url] .

Lutz

#1
You can specify your own options after the script name and they will not be confused with newLISP options:



[newlisp /home/public]$ newlisp test -word -lol
=>("newlisp" "test" "-word" "-lol")
[newlisp /home/public]$


or as a shell script:



[newlisp /home/public]$ ./test -word -lol
=>("/home/public/cgi-bin/newlisp" "./test" "-word" "-lol")
[newlisp /home/public]$


don't forget an (exit) statement at the end of your script, or newLISP will try to process the options meant to be for the script:



#!/home/public/cgi-bin/newlisp

(println "=>" (main-args))

(exit)    ; important




ps: when using the -w option for newLISP, it should not be followed by a script, except when you adjust the path to the script accordingly