TheLost
TheLost

Reputation: 27

Read terminal argument and pass the function in lisp?

(defun gppinterpreter (filename)
    (setq fileContent (read-a-file filename))
    (write filecontent)
)
(gppinterpreter filename)

I compile this file in ubuntu

clisp example.lisp

I want to get the filename parameter directly from the terminal such as >> clisp example.lisp filename

but this command not working. How can I get filename parameter in gppinterpreter from terminal

Upvotes: 0

Views: 263

Answers (1)

Robert
Robert

Reputation: 2812

In Clisp, the program arguments are given in the variable EXT:*ARGS*..

https://clisp.sourceforge.io/impnotes/clisp.html

Before it is loaded, the variable EXT:ARGS is bound to a LIST of STRINGs, representing the arguments given to the Lisp script (i.e., $1 in /bin/sh becomes (FIRST EXT:ARGS) etc).

So I think you want to use (second EXT:*ARGS*)

Upvotes: 1

Related Questions