PaulM
PaulM

Reputation: 305

Running guile code as shell script - guile init file?

I am running guile code as a shell script (starting the script file with #!/usr/bin/guile etc.) -- its working as expected, but when I do this, guile does not load my guile initialization file ~/.guile as it normally does. Is there a different init file I need in this circumstance?

thanks

Upvotes: 2

Views: 609

Answers (1)

Shawn
Shawn

Reputation: 52354

From the documentation (Emphasis added):

When run interactively, Guile will load a local initialization file from ~/.guile.

and also

-q Do not load the initialization file, .guile. This option only has an effect when running interactively; running scripts does not load the .guile file. See Init File.

So what you're seeing is normal, expected behavior. But you can use the -l filename option to load a scheme file before the rest of the script. Something like:

#!/usr/bin/guile \
-l /home/XXXX/.guile -s
!#

; your script here

You do have to provide an absolute path to the file; things like tilde expansion aren't done when invoked using the meta switch because the shell isn't involved.

Upvotes: 2

Related Questions