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

Re: /etc/init.d/network is too simple?

Hash: SHA1

On Sat, 17 Apr 1999 16:08:50 +1000, Hamish Moffatt wrote:

>It is essential to have a /bin/sh; how will you ensure this if no one
>shell is essential?

    Not quite sure yet.
>And the advantage to making bash non-essential is ... ?

    Glad you asked...

{morpheus@mania:/home/morpheus}ls -l `which bash ash zsh`
- -rwxr-xr-x   1 root     root        87788 Sep  7  1998 /bin/ash
- -rwxr-xr-x   1 root     root       426980 Oct 19 19:57 /bin/bash
- -rwxr-xr-x   2 root     root       367708 Jan 22 11:02
/usr/bin/zsh{morpheus@mania:/home/morpheus}ps ux
morpheus   379  0.0  5.2  1580   992  p2 S N  20:30   0:00 zsh 
morpheus   451  3.0  5.4  1760  1028  p5 S N  22:13   0:00 bash 
morpheus   452  0.8  1.7   816   328  p6 S N  22:13   0:00 ash 

    By moving away from an interactive shell[1] being linked to /bin/sh and,
by that very nature, as you pointed out, essential, to a non-interactive
shell[1] one can dramatically reduce the load.  Why run an interactive shell
for scripts which are non-interactive and require all that overhead?

    As you can see, of the three shells on my laptop, ash, which is
barebones, is obviously the smallest.  zsh, which is my prefered login shell,
clocks in 2nd.  bash, the essential and default "/bin/sh" is the largest.  In
short, more memory for other programs, faster load times on scripts, etc. 
Maybe not perceptable in and of themselves, but over the long haul
repetitions of a machines career, it adds up.  My laptop does boot
perceptably faster with ash as /bin/sh than bash.

    My point isn't to solve the myriad of technical problems, nor do I
dispute that /bin/sh isn't essential, just that bash isn't, IMHO, essential
and is most certainly not a clear choice as /bin/sh based on
performance/space considerations.

[1]  I define "interactive" and "non-interactive" shells based on whether or
not they have "basic" functions on the command-line.  Command history, tab
completion and the like make a shell interactive, IE, convenient for a human
to use interactively.  The lack of those features make it hard for a human to
use the shell interactively, hence non-interactive shells.  By this
definition alone ash and sash are non-interactive, bash, zsh, tcsh all are
However, sash being statically linked with versions of common utils built in
serves another role which has been discussed in an offshoot of this thread.

- -- 
         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
         ICQ: 5107343          | main connection to the switchboard of souls.
- -------------------------------+---------------------------------------------

Version: PGPsdk version 1.0 (C) 1997 Pretty Good Privacy, Inc


Reply to: