I'm running a single program in newlisp and want to pass an argument:
newlisp dl.lsp '123456'
I doesn't seem like newlisp accepts openargs. Did I miss something?
I suppose I could write it to a text file and have the program read the text file to retrieve the info :(
Command line: passing open arg ?
Re: Command line: passing open arg ?
I see I need to link it into an exe, then I can pass cmd line args. Thanks.
Re: Command line: passing open arg ?
You don't need to link to an .exe to get the command line parameters. If your dl.lsp is:
then:
Note, that all arguments are passed as strings, even if not quoted.
On UNIX you could add as first line in the script:
After giving dl.lsp executable permissions, you can do:
Code: Select all
(println "The command line args are: " (main-args))
(println "The last one is: " (int (main-args -1)))
(exit)
Code: Select all
~> newlisp dl.lsp 12345
The command line args are: ("newlisp" "dl.lsp" "12345")
The last one is: 12345
~>
On UNIX you could add as first line in the script:
Code: Select all
#!/usr/bin/newlisp
(println "The command line args are: " (main-args))
(println "The last one is: " (int (main-args -1)))
(exit)
Code: Select all
~> ./dl.lsp 12345
The command line args are: ("/usr/bin/newlisp" "./dl.lsp" "12345")
The last one is: 12345
~>
Re: Command line: passing open arg ?
Very cool. Thank you!