First of all this might be really basic thing but I do not know how to proceed. I have Guile 2.0.9
and Libctl 3.2.2
installed on my Ubuntu 14.04.1 64-bit LTS. My aim is to write a source file in Scheme
then have it interpret by Guile
so I do not spend too much time on the prompt trying to correct some minor errors(correcting errors on a file is much easier). How can I have it read and execute the contents of my source file?
If you want to run .scm source file as a command line program you have to add at the head of your file:
#!/usr/bin/guile -s
!#
where you must specify proper path to you guile
executable. You can find location of guile
by
which guile
and you will get something like /usr/bin/guile
And do not forget to make you file executable:
chmode +x file.scm
If you want to set particular entry point to your program than there is another way to start script file:
#!/usr/bin/guile \
-e main -s
!#
-e
option specify a program entry point function name.
For example file.scm
#!/usr/bin/guile \
-e main -s
!#
(define (main args)
(display "Hello ")
(write (cdr args))
(newline))
Now let run it
[root@tuxbox ~]# ./file.scm Jim
Hello ("Jim")