The best scripts ever (trick or treat)

Giorgos Keramidas keramida at ceid.upatras.gr
Wed Nov 2 13:34:52 PST 2005


On 2005-11-02 13:09, Gary Kline <kline at tao.thought.org> wrote:
>On Wed, Nov 02, 2005 at 10:47:43PM +0200, Giorgos Keramidas wrote:
>>On 2005-11-02 12:42, Gary Kline <kline at tao.thought.org> wrote:
>>>On Wed, Nov 02, 2005 at 10:14:40PM +0200, Giorgos Keramidas wrote:
>>>>> BEGINSCRIPT
>>>>> !#/bin/sh
>>>>> echo "hello world"
>>>>> ENDSCRIPT
>>>>
>>>> What happens when the script itself contains a line that starts
>>>> with one of the special "markup" lines?
>>>
>>> AFAIK, the only markup lines this would use would be
>>> the <TAGS></TAGS>.  A sh script might use the ">" or "<"
>>> for redirection, but the conversion script would ignore
>>> everything between
>>>
>>> BEGINSCRIPT
>>> ENDSCRIPT
>>>
>>> which would make parsing straightforeward.
>>
>> Unless the shell script itself contains 'ENDSCRIPT' somewhere ;-)
>>
>> This is what I was referring to as "markup".
>
> Hmmm!   :-)
>
> Okay, then what about
> BEGIN_somelonghexstringthatis256byteslong
>
> and
>
> END_somelonghexstringthatis256byteslong

That's an idea.  A simple shar(1) archive could probably work too:

    flame:/home/keramida$ shar .forward
    # This is a shell archive.  Save it in a file, remove anything before
    # this line, and then unpack it by entering "sh file".  Note, it may
    # create directories; files and directories will be owned by you and
    # have default permissions.
    #
    # This archive contains:
    #
    #       .forward
    #
    echo x - .forward
    sed 's/^X//' >.forward << 'END-of-.forward'
    X|/usr/local/bin/procmail
    END-of-.forward
    exit



More information about the freebsd-questions mailing list