Re: [dev] s - suckless shell

From: Wolfgang Corcoran-Mathe <wcm_AT_sigwinch.xyz>
Date: Sat, 13 Aug 2016 12:26:35 -0400

Hi rain1,

Quoth rain1_AT_openmailbox.org:
>GNU Bash is 138227 lines of code. I wrote a simpler shell* in 800
>lines: https://notabug.org/rain1/s/
>
>*It is not a true POSIX shell. You can't run existing scripts with it.
>It's technically just a command interpreter.

A point of design philosophy.

While I appreciate the attempt to create a minimal shell, I don’t
believe this is worth the sacrifice of generality. A shell without
builtin I/O redirection, control flow, non-environment variablew, etc.
is crippled as a scripting language.

Writing a C compiler would be much easier and would require far less
code if we used a tiny subset of C. We could simplify grep(1) by
pulling out regular expressions, or sed(1) by having it handle only
s/// commands. But in each case there would be a new, less general
tool to learn whose only reason for existence is a lower line count.

Bloat is not measured in SLOC, but in the deviation of the design from
the tool’s true use. Traditional shells are system automators as well
as command interpreters, and much of their usefulness and longevity
comes from this generality. You might complain about the bloat of sh,
but I doubt that a shell language stripped of excess could be much
simpler than rc(1) without sacrificing most of what makes shells
useful.

Regards,

-- 
wcm
Received on Sat Aug 13 2016 - 18:26:35 CEST

This archive was generated by hypermail 2.3.0 : Sat Aug 13 2016 - 18:36:10 CEST