Thanks, Alex. Now I'm on track again, using (opt).
On 28-10-13 11:38 , Alexander Burger wrote:
that command line arguments to work, starting with a "-". I want my
concatJsonsIntoArray.l to write its result to a file ../test.json.
How can I give that file path as an argument to my script?
It depends how you call your script. The example I gave
(de isJSON (F)
(= "a" (pack (stem (chop F) "."))) )
(let Fout (opt)
(prinl "No output file argument given")
(let Sep "["
(for Fin (dir)
(when (isJSON Fin)
(in Fin (echo))
(setq Sep ",") ) ) )
(prinl "]") ) )
works if you call it as you did in your first mail
$ pil ../concatJsonsIntoArray.l ../test.json +
because then (opt) is called inside "concatJsonsIntoArray.l" and it eats
up the following argument "../test.json".
I've tried to read this
<http://www.software-lab.de/doc/tut.html#script>, but it didn't help
'script' is a different thing. It is not useful to be applied to command
line arguments, because these are already implicitly handled with
'load'. 'script' _is_ 'load', just with argument binding analog to
functions with variable arguments.
In short, I would recommend to go with (opt).