🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.bugs
Article #54

/bin/sh $# bug with nested functions

#54
From: Marcel Waldvogel
Date: Tue, 12 Jan 1993 16:02
28 lines
923 bytes
Another nasty bug (which prevents me using 'shql' for now):

	#!/bin/sh
	nested_func(){
	        echo "inside: $#"
	}
	func(){
	        echo "before: $#"
	        nested_func 6 7 8
	        echo "after : $#"
	}
	func 1 2 3 4 5

gives the following output (on 2.1 and on 3.0):

	before: 5
	inside: 3
	after : 3

Every other system I've tried returns

	before: 5
	inside: 3
	after : 5

This is in accordance to what I expect from the behaviour of parameter passing.

-Marcel
Technical Details
Message-ID: <1993Jan12.160259.7994@bernina.ethz.ch>
Path: arc1-ca.pugleaf.net!sparky!uunet!news.univie.ac.at!chx400!bernina!waldvoge

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.bugs
Path: arc1-ca.pugleaf.net!sparky!uunet!news.univie.ac.at!chx400!bernina!waldvoge
From: waldvoge@nessie.cs.id.ethz.ch (Marcel Waldvogel)
Subject: /bin/sh $# bug with nested functions
Message-ID: <1993Jan12.160259.7994@bernina.ethz.ch>
Sender: news@bernina.ethz.ch (USENET News System)
Organization: Swiss Federal Institute of Technology (ETH), Zurich, CH
Date: Tue, 12 Jan 1993 16:02:59 GMT
Lines: 28