help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using Emacs Lisp for script writing


From: Cecil Westerhof
Subject: Re: Using Emacs Lisp for script writing
Date: Tue, 22 Dec 2009 18:04:10 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux)

address@hidden (Pascal J. Bourguignon) writes:

>>> It is not a big deal, but when the script is put on another system and
>>> on this system clisp is in another location, the script has to be
>>> modified (or a link has to be created). But halving the execution time
>>> is important enough.
>>
>> There is a trick used by other scripting languages to get around the
>> issue of the script interpreter being in a different location and for
>> those systems which only handle 30 characters in the #! line
>>
>> #!/bin/sh 
>> # the next line restarts using the interpreter foobar \
>> exec foobar "$0" "$@"
>>
>> I wonder if something like this could work. 
>
> Sure.
>
> address@hidden :0.0 ~]$ cat ./s 
> #!/bin/sh
> #| Both a lisp and sh comment.
> exec clisp "$0" "$@" 
> |#

Works like a charm. I made it:
    #!/usr/bin/env bash
    #| Both a lisp and sh comment.
    exec clisp -C "$0" "$@" 
    |#

And now all three work:
    script.cl
    clisp -C script.cl
    clisp -c script.cl

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


reply via email to

[Prev in Thread] Current Thread [Next in Thread]