Mailing List Archive

Support open source code!


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

Re: shell state of mind



>>>>> On Wed, 31 Jan 2001 16:58:49 +0900, "Stephen J. Turnbull" <turnbull@example.com> said:

>>>>> "sb" == SL Baur <steve@example.com> writes:
    sb> This was why the $( ... ) notation was invented.

    SJT> Actaully, I bet Uvator generated that with a Perl script!

I'm sure it'd look much nicer in lisp, or cleaner in perl if writen by
a perl expert ;)


#!/usr/local/bin/perl -w
use strict;

my $a = shift;
print f(0) . "\n";

sub f {
    my $b = shift;
    my $bq = ($b>0?'`':'');
    my $bs = '\\'x($b>1?((1<<$b-1)-1):0);

    return $bs . $bq . "echo $b " . (($b<$a)?f($b+1):'') . $bs . $bq;
}


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links