ksh function behaviour change

From: Alex Kok <c753330_at_nlzcl1.decnet.philips.nl>
Date: Tue, 24 Jun 1997 09:47:30 GMT

Esteemed colleagues!

A trainee of mine noted a change of behaviour in the Korn shell in Dunix 4.0.
It concerns the way functions work with $0. I have written a small script
I called "functienaam" illustrating the behaviour change:

#!/bin/ksh
function demo
        {
        print $0
        }
print "Script: `whence $0`"
print -n "Function name: "
demo
exit

On Dunix 3.2G (and HP-UX 10), this results in the expected:
scdw$ ./functienaam
Script: /home/c753330/./functienaam
Function name: demo

On Dunix 4.0 and 4.0B the function does not return it's own name:
nlasdc06.lss.cp.philips.com:sysmgr> ./functienaam
Script: /home/sysmgr/kok/./functienaam
Function name: ./functienaam

Note the different result following "Function name:". Is this a "feature" of
v4.0, or have I overlooked something? Or is it a bug? Or is it "Posix" perhaps?

TIA and greetings, Alex Kok ( Alex.Kok_at_nlzcl1.decnet.philips.nl )
Received on Tue Jun 24 1997 - 12:25:28 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:36 NZDT