🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1133

Bourne shell differences w.r.t functions?

#1133
From: Erik E. Rantapaa
Date: Thu, 13 Sep 1990 16:38
24 lines
1366 bytes
In experimenting on various systems, I have found the following
differences in the way /bin/sh handles functions:

   * Some give functions their own private argument list.
   * Some have arguments passed to functions overwrite the script's
     argument list.
   * Some don't support functions at all.

I have some questions that maybe the net could help with:

If /bin/sh supports functions, which behavior is more common?

Also, does the fact that some Bourne shells don't support functions
mean that I shouldn't use functions in scripts which I send out for
general use?  Are replacements such as bash and ksh widely enough
available so people can use them if they have a defective /bin/sh?

For maximum portability, should I just avoid using functions
altogether? :(

Finally, what is the POSIX standard with regard to this?
-- 
Erik Rantapaa
  rantapaa@cs.umn.edu
Technical Details
Message-ID: <1990Sep13.163836.19937@cs.umn.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!tut.cis.ohio-state.edu!uc!cs.umn.edu!rantapaa

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!tut.cis.ohio-state.edu!uc!cs.umn.edu!rantapaa
From: rantapaa@cs.umn.edu (Erik E. Rantapaa)
Newsgroups: comp.unix.shell
Subject: Bourne shell differences w.r.t functions?
Summary: What should I do about them?
Keywords: Bourne shell, /bin/sh, functions, ksh, bash, argument list, POSIX
Message-ID: <1990Sep13.163836.19937@cs.umn.edu>
Date: 13 Sep 90 16:38:36 GMT
Organization: University of Minnesota, Minneapolis - CSCI Dept.
Lines: 24