Shells, features and interaction

Daniel R. Levy levy at ttrdc.UUCP
Tue Nov 19 11:09:31 AEST 1985


In article <4575 at alice.UUCP>, rob at alice.UucP (Rob Pike) writes:
>The recent shell discussion prompted by Arnold Robbins's announcement has
>missed an important point: effective programmability in an interactive
>system can obviate many supposed `features'.
>
>Those who claim shell functions are the way to do aliasing are right, but
>the only implementation that works properly for this purpose is in the
>8th edition shell.  The problem is that unless functions can be exported,
>they are unavailable to subshells and shell files.  In the 8th edition shell,
>functions are literally exported, and passed in the environment as
>shell input text.  This sounds expensive, but on most current systems,
>argument and environment passing through exec(2) is so efficient that a few
>Kbytes of extra environment are probably cheaper than adding a directory
>to PATH.  Shells like csh or ksh that read function (or equivalent) definitions
>from a file at start up have peculiar semantics, can't provide an export
>facility that works properly, and are probably no more efficient.

I for one ask--why would one WANT to export a function to a shell script?
If the interactive shell from which the script were invoked were something
like csh, how would it even be possible to export the function to the
script?  And mightn't it break a shell script if it used a command which
you had made into a function and exported, but which it was expecting to
be a standard executable?  I perhaps could see the desireability to have
INTERACTIVE subshells (spawned by shell escapes from things like
vnews :-) inherit the functions to avoid having to read a startup file.
But exporting to shell scripts?  Enlighten me.
-- 
 -------------------------------    Disclaimer:  The views contained herein are
|       dan levy | yvel nad      |  my own and are not at all those of my em-
|         an engihacker @        |  ployer or the administrator of any computer
| at&t computer systems division |  upon which I may hack.
|        skokie, illinois        |
 --------------------------------   Path: ..!ihnp4!ttrdc!levy



More information about the Comp.unix mailing list