[CM] Mixing scheme script with shell script

e deleflie edeleflie at gmail.com
Fri Sep 19 03:48:09 PDT 2008


great, thanks Kjetil and Richard...

I'm going for the master shell script ... I was trying to avoid having
4 or 5 files each containing different bits of one core logic + a
master one to put them together ... but I guess mixing interpreters in
one script is not really 'nice' either (let alone doable).

Etienne

On Fri, Sep 19, 2008 at 8:22 PM, Kjetil S. Matheussen
<k.s.matheussen at notam02.no> wrote:
>
>
> On Fri, 19 Sep 2008, Richard Lewis wrote:
>
>> On Thursday 18 September 2008 03:12:12 e deleflie wrote:
>>>
>>> Does anyone know if it is possible to mix up an SND scheme script
>>> with normal shell script calls? (including sharing/passing
>>> parameters between them?)
>>>
>>> something like this: (note:tried the below and it doesn't work)
>>>
>>> #!/usr/local/bin/snd -b
>>> !#
>>> (use-modules (ice-9 format))
>>> (load "dsp.scm")
>>> ...
>>> (exit)
>>> #!/bin/sh
>>> echo $HOME
>>>
>> The lines beginning #! are called shebang lines and they tell the
>> shell which interpreter to invoke to execute the script. At least
>> for Bash on my Linux box (and I except the same is true elsewhere),
>> it's not possible to have the shell switch interpreters during the
>> execution of a script.
>>
>> One possible solution would be to write one sort of master shell
>> script which executes your scheme scripts:
>>
>> foo.scm:
>> #!/usr/local/bin/snd -b
>> (use-modules (ice-9 format))
>> (load "dsp.scm")
>>
>> master.sh:
>> #!/bin/sh
>> ./foo.scm
>> echo $HOME
>>
>> Then run master.sh to execute the whole lot.
>
>
> Oh, and the other way is to use the "system" function in Guile:
>
> master.scm:
> #!/usr/local/bin/snd -b
> (use-modules (ice-9 format))
> (load "dsp.scm")
> ...
> (system "sh foo.sh")
> (exit)
>
> foo.sh:
> echo $HOME
>
>
> Or simply:
>
> master.scm:
> #!/usr/local/bin/snd -b
> (use-modules (ice-9 format))
> (load "dsp.scm")
> ...
> (system "echo $HOME")
> (exit)
>
> _______________________________________________
> Cmdist mailing list
> Cmdist at ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist
>



More information about the Cmdist mailing list