Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!uw-june!ka From: ka@june.cs.washington.edu (Kenneth Almquist) Newsgroups: comp.unix.wizards Subject: Re: Bourne shell Message-ID: <8140@june.cs.washington.edu> Date: 8 May 89 04:24:28 GMT References: <5549@lynx.UUCP> Distribution: na Organization: U of Washington, Computer Science, Seattle Lines: 21 m5@lynx.uucp (Mike McNally) asks: > How is the BSD (version 7?) Bourne shell so small? Did Mr. Bourne make > a deal with the Devil, getting unreal code compactness in return for > an eternity in a sulfurous pit where the flames never stop burnin' ya? If so, the Devil cheated (as usual). The Bourne shell was about 21K bytes. The previous version of the shell was only about 7K bytes. The size is partly a matter of careful coding, partly a matter of designing features so that they won't require too much space, and partly a matter of not throwing in lots of (possibly unnecessary) features. Consider function definitions. Function defintions in the System V shell are executable, so that the function definitions are parsed, and then copied when the function definition is executed. The code in ash to perform this copying takes nearly 1K bytes (and this is code that is written without any particular attention to coding style, since it is computer generated). If functions had been added to the shell in the early days of UNIX, the shell language might have been redesigned to eliminate this copy. Kenneth Almquist