Bourne shell functions

Robert E. Lancia rob at meaddata.com
Sat Jun 22 05:47:49 AEST 1991


I'm looking for comments/suggestions/flames concerning the following:

One of our systems is a Sequent computer running DYNIX V3.0.17.v3.
(DYNIX is strange in itself, in that it has completely separate
AT&T and UCB universes, both of which IMHO seem incomplete.)  Anyway,
in trying to write part of a simple Bourne shell script, I found that
their shell doesn't support functions and I came up with a work-around.


As a trivial example consider a function for clearing the screen, 
listing files, and getting confirmation to continue.

#
#  normal function declaration        my work around declaration
#  ===========================        ==========================
#      list_files ()                  list_files='
#      {                                  clear;
#          clear                          echo "Files:";
#          echo "Files:"                  ls $file_dir;
#          ls $file_dir                   echo "Hit <Enter> key";
#          echo "Hit <Enter> key"         read dummy;
#          read dummy                 '
#      }
#
#      Invoked as                     Invoked as
#      ==========                     ==========
#      .  .  .                        .  .  .
#      list_files                     eval $list_files
#      .  .  .                        .  .  .
#

The simple examples I've tried all seem to work, and I can't come up
with a scenario in which won't work.

Comments? / Suggestions? / Problems?

Rob.
--
|Robert Lancia                 | The above opinions    | Mead Data Central
|(513) 297-2560                | may not necessarily   | Data Services Division
|rob at pmserv.meaddata.com       | be MDC's.  Heck, they | P.O. Box 308
|...!uunet!meaddata!pmserv!rob | may not even be mine. | Dayton, Ohio  45401



More information about the Comp.unix.shell mailing list