Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!meaddata!rob From: rob@meaddata.com (Robert E. Lancia) Newsgroups: comp.unix.shell Subject: Bourne shell functions Message-ID: <4973@meaddata.meaddata.com> Date: 21 Jun 91 19:47:49 GMT Sender: usenet@meaddata.com Reply-To: rob@pmserv.meaddata.com Organization: Mead Data Central, Dayton OH Lines: 43 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 key"; # echo "Hit 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@pmserv.meaddata.com | be MDC's. Heck, they | P.O. Box 308 |...!uunet!meaddata!pmserv!rob | may not even be mine. | Dayton, Ohio 45401