Path: utzoo!attcan!uunet!cs.utexas.edu!helios!archone!byron From: byron@archone.tamu.edu (Byron Rakitzis) Newsgroups: comp.unix.shell Subject: Re: flavours of shell - what is there? Message-ID: <8806@helios.TAMU.EDU> Date: 4 Oct 90 18:59:49 GMT References: <4278@ecs.soton.ac.uk> <43508@sequent.UUCP> Sender: usenet@helios.TAMU.EDU Organization: College of Architecture, Texas A&M University. Lines: 62 In article <43508@sequent.UUCP> calvin@crg1.sequent.com (Calvin Goodrich) writes: >In article <4278@ecs.soton.ac.uk> tjc@ecs.soton.ac.uk (Tim Chown) writes: >> >>The ones I know of are simply: >> sh csh bash ksh >> >>Are there others? Where are they principally available from? > >here's a little known shell ... > >nsh: > > NutSHell, the smallest UnixTM shell yet. Version 1.0 (the only >one released so far) includes only 'cd' and 'echo '. >GNU-nsh, to be released later this year, is expected to be much more >powerful, with built-in Bourne, Korn and C shell emulators. The executable >is expected to go from 306 bytes to 7Mb with this release, however. > >(all this comes with a huge :]. i mean really this is one of the few groups > i've seen that hasn't had any injected humor. ripped off without permission > from rec.humor.) > >calvin. At the risk of seeming like a braggart, please let me include the source code to "bsh", the "bull-shell". It is even smaller than the nsh, since it has only cd as a builtin. It performs io-redirection and pipes, however. You may have seen this shell in the 1990 Obfuscated C comptetition. bsh.c (by Byron Rakitzis and Sean Dorward) --------------------------------CUT HERE---------------------------- # to unbundle, sh this file # bundled by byron on archone at Thu Oct 4 13:57:32 CDT 1990 # contents of bundle: # bsh.c echo bsh.c sed 's/^-//' > foo.c <<'end of bsh.c' -#define D ,close( - -char *c,q [512 ],m[ 256 -],*v[ 99], **u, *i[3 ];f[ 2],p; main (){for - (m[m [60]= m[62 ]=32 ]=m[* m=124 [m]= 9]=6; - e(-8) ,gets (1+( c=q) )|| exit (0); r(0,0) - )for( ;*++ c;); }r(t, o){ *i=i [2]= 0;for - (u=v +98 ;m[*--c] ^9;m [*c] &32 ?i[*c - &2]= *u,u- v^98 &&++u: - - 3 )if(!m[*c]){for(*++c=0;!m[*--c];); - * --u= ++c;}u-v^98?strcmp(*u,"cd")?*c?pipe(f),o=f[ - 1 ]: - 4 ,(p=fork())?e(p),o?r(o,0)D o)D*f): - 1 ,wait(0):(o?dup2(*f,0)D*f)D o):*i? - 5 D 0),e(open(*i,0)): - 9 ,t?dup2(t,1)D t):i[ - 2 ]? - 6 D 1),e(creat(i[2],438)): - 5 ,e(execvp(*u,u))):e(chdir(u[1])*2): - 3 ;}e(x){x<0?write(2,"?\n$ "-x/4,2),x+1||exit(1): - 5 ;} end of bsh.c