cc: [email protected]
Subject: Re: [ast-users] ksh function search baffles me
--------
> I use my own preferred functions for 'dirs' etc., and am having difficulty
> getting them recognized without explicitly sourcing them.
>
> For the purpose of this example, I have a version with easily recognizable
> behaviour:
>
> Script started on Tue 03 Aug 2010 02:29:56 PM EDT
> $ cat /tmp/test/fun/dirs
> function dirs
> {
> print -- 'My dirs!'
> }
>
> I added a corresponding bin/.paths for good measure:
This should not be needed. It can be used instead of FPATH.
>
> $ cat /tmp/test/bin/.paths
> FPATH=../fun
>
> I start a new, clean ksh, with PATH and FPATH explicitly set so that mine
> comes
> first (here /opt/att is a symlink to, in this case,
> /opt/ast/arch/linux.i386-64)
> :
>
> $ env - \
> > PATH=/tmp/test/fun:/tmp/test/bin:/bin:/usr/bin:/opt/att/bin \
> > FPATH=/tmp/test/fun \
> > ksh
>
> Now:
>
> $ type dirs
> dirs is an undefined function
> $ dirs
> 1) ~/home/kpschoed
>
> Not my function, obviously. I don't understand why.
I was unable to reproduce this. There is only one reason that I can think of
that would execute a different dirs. If dirs was defined in the /etc/ksh.kshrc
file. However, in this case
type dirs
would not give dirs is an undefined function.
Maybe running under strace (or truss) will give a clue.
>
> "Insanity is doing the same thing over and over again but expecting different
> results", so here goes:
>
> $ unset -f dirs
> $ type dirs
> dirs is an undefined function
> $ dirs
> My dirs!
>
> Could someone clue me in on what's happening here?
This is what I would have expected.
What version of ksh93 are you running?
print ${.sh.version}
>
>
> --
> Kevin Schoedel <[email protected]> VA3TCS
>
David Korn
[email protected]
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users