Thanks Manfred and Thomas, I'm just about to try these. One more requirement that I forget to mention is that it should also be possible to handle "expect" type of "automated conversations". You can pass several independent commands with system/output without problem, but I had difficulties in figuring out how to log into different machines, change the user etc. where you need to pass answers interactively or otherwise move between various modes (which expect can automate).
There is possibly a more schemy way of doing this, but I'm trying to find an easily adaptable way to reuse existing system scripts and turn them into scheme primitives for higher abstractions. br, jukka > -----Original Message----- > From: users-boun...@racket-lang.org > [mailto:users-boun...@racket-lang.org]On Behalf Of Manfred Lotz > Sent: 06 February 2011 12:51 > To: users@racket-lang.org > Subject: Re: [racket] Embedding multiline shell scipts > > > On Sun, 6 Feb 2011 11:26:40 +0200 > "Jukka Tuominen" > <jukka.tuomi...@finndesign.fi> wrote: > > > > > Hi all, > > > > I'm trying to embed multiline shell scripts within a scheme function, > > but I'm not quite sure how to do it. > > > > With multiline shell scripts I mean the scripts that are usually > > saved as separate files containing for example: > > > > --- > > #!/bin/sh > > > > while home > > do > > ... > > done > > The following should work, although there might be a better way > doing it: > > > (define shebang "#! /bin/sh\n") > > (define script-body " > > while home > do > ... > done > ") > > (define script (string-append shebang script-body )) > > > (call-with-output-file "testscript.sh" #:mode 'text #:exists 'replace > (lambda (out) > (fprintf out "~a" script))) > > > > -- > Manfred > > > > > > > > _________________________________________________ > For list-related administrative tasks: > http://lists.racket-lang.org/listinfo/users _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users