Sam Trenholme's webpage
This article was posted to the Usenet group alt.hackers in 1995; any technical information is probably outdated.

Re: Smallest Unix Shell


Article: 8780 of alt.hackers
Newsgroups: alt.hackers
From: mrs@netcom.com (Morgan Schweers)
Subject: Re: Smallest Unix Shell
Message-ID: mrsDFzyuF.9AC@netcom.com
Organization: Foxsoft Cyberware
Date: Thu, 5 Oct 1995 22:37:27 GMT
Approved: Gosh, I hope so...
Lines: 36
Sender: mrs@netcom11.netcom.com
Status: RO

Greetings,

Some time ago trreka@uta.fi (Reijo Kalvas) happily mumbled:
>In article <43q9vk$rso@euryale.cc.adfa.oz.au>,
>Warren Toomey <wkt@dolphin.cs.adfa.oz.au> wrote:
>>ObHack: A challenge with a friend to come up with the smallest
>>Unix shell in C.
>>Here's the results, the smallest being 123 characters (124 with a \n):
>
>ObHowAbout:
>
>b[99];main{while(!system(gets(b)));}
>
>38 characters and breaks probably all rules.  Well, this is
>alt.hackers, eh?  ctrl-d exits.
>

ObHack Explanation:

    Actually, you cannot replace your shell with this program.
It goes into a painful endless loop, I believe.

    (Specifically you couldn't make it your 'real' shell, because the
'system' function shells to your real shell (I believe), which would
be this, and then it would prompt you again.  (Note: The need for a
prompt expands your program a bit too...))

    The shells being described before were actually fully functional
replacements for the Unix shell.

                                   --  Morgan Schweers
--
Morgan Schweers |  New Chrome Grass!  Finger mrs@netcom.com for my PGP key   |
Live fast, die   \ B1 S4 a b g j++! k l? p r- s t+ u v- w+ x y- z, approx.__/
old, and leave a smouldering pile of metal as a corpse...  It's never enough,
until your heart stops beating, the deeper you get, the sweeter the pain...



Parent Parent

Child

Back to index