Reputation: 33
So I have a simple file.scm
file with following code in it:
#!/usr/bin/guile -s
!#
(define (printer arg)
(display arg))
I know you can execute it inside guile repl by doing a (load "file.scm")
, and then by invoking the function like (printer "this")
.
Is there is any way to run that function through the command-line terminal
such as guile "file.scm" (printer "this")
?
Upvotes: 2
Views: 773
Reputation: 2575
You could just use the -e
flag
guile -e printer file.scm 1 2 3
Or better yet
#!/usr/bin/env -S guile -e printer
!#
(define (printer args)
(display args))
and run as
./file.scm 1 2 3
Many other (official) Guile Scripting examples: https://www.gnu.org/software/guile/manual/html_node/Scripting-Examples.html
Upvotes: 0
Reputation: 52354
According to the manual, something like
guile -l file.scm -c '(printer "this")'
will work.
Upvotes: 3