Hi,

Could someone please confirm what should be the value of $0 for
the below test case.

I see that $0  in the ksh93u version referred to the pathname of the
sourced script
when we source a script from inside a ksh style function.
This behaviour changed from the 93u+ version, now $0 refers to the function
name.

root@S11:~# cat /root/test2/runTest.ksh
. /root/test1/include.ksh
load /root/test1/config

root@S11:~# cat /root/test1/include.ksh
function load
{
. $1
}

root@S11:~# cat /root/test1/config
echo "\$0 in config is $0"

root@S11:~# /usr/bin/ksh93 --version
  version         sh (AT&T Research) 93u 2011-02-08
root@S11:~# ./ksh2012 --version
  version         sh (AT&T Research) 93u+ 2012-08-01
root@S11:~# ./ksh2013 --version
  version         sh (AT&T Research) 93v- 2013-10-08

root@S11:~# /usr/bin/ksh93 /root/test2/runTest.ksh
$0 in config is /root/test1/config

root@S11:~# ./ksh2012  /root/test2/runTest.ksh
$0 in config is load

root@S11:~# ./ksh2013  /root/test2/runTest.ksh
$0 in config is load

Thanks,
Lijo
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to