🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #142

Bash functions incompatibility with sh?

#142
From: Brian Glendenning
Date: Mon, 26 Jun 1989 20:10
26 lines
1386 bytes
The following may not be a bug, it may be due to my not understanding
shell functions properly. It does, however,  seem to be at least an
incompatibility with sh (the one on SunOS 4.0.1 anyway), and I would
also appreciate knowing the correct way to do this type of thing if
I'm mishandling the syntax.

Under sh if I type:

c() { for i in a b c d; do echo $i; done ; }

then "c" does what I expect (i.e. echoes a b c d each on a new line).
However under bash exactly the same line gives me:

syntax error near `do'

So, I'd like to report this incompatibility, and ask for the correct
syntax for getting "for" "while" "if" and friends into bash shell
functions. Thanks.

--
	  Brian Glendenning - Radio astronomy, University of Toronto
brian@radio.astro.utoronto.ca uunet!utai!radio!brian  glendenn@utorphys.bitnet
-- 
	  Brian Glendenning - Radio astronomy, University of Toronto
brian@radio.astro.utoronto.ca uunet!utai!radio!brian  glendenn@utorphys.bitnet
Technical Details
Message-ID: <BRIAN.89Jun26160957@radio.astro.utoronto.ca>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!radio.astro!brian

Show Full Headers
Complete Article Headers
Newsgroups: gnu.bash.bug
Path: arc1-ca.pugleaf.net!utzoo!utgpu!radio.astro!brian
From: brian@radio.astro.utoronto.ca (Brian Glendenning)
Subject: Bash functions incompatibility with sh?
Message-ID: <BRIAN.89Jun26160957@radio.astro.utoronto.ca>
Sender: brian@radio.astro.utoronto.ca (Brian Glendenning)
Organization: Radio Astronomy, Univeristy of Toronto
Distribution: gnu
Date: Mon, 26 Jun 89 20:10:03 GMT