[comp.unix.questions] KSH question - there's gotta be a way.

bobm@rtech.UUCP (Bob Mcqueer) (01/17/87)

But I can't find it in the man page.  How do I get the shell to
show me the definition for a function, as opposed to an alias?  The
command "typeset -f" will list defined functions.  Suppose I want to
see what function "foo" is defined to be?  "whence -v" would be the
natural candidate, but it just says "foo is a function".
-- 

Bob McQueer
{amdahl, sun, mtxinu, hoptoad, cpsc6a}!rtech!bobm

ekrell@ulysses.homer.nj.att.com (Eduardo Krell) (01/19/87)

In article <605@rtech.UUCP> bobm@rtech.UUCP (Bob Mcqueer) writes:
>But I can't find it in the man page.  How do I get the shell to
>show me the definition for a function, as opposed to an alias?  The
>command "typeset -f" will list defined functions.

Since "typeset -f" lists all functions, I would expect "typeset -f foo"
to list function "foo". Sure enough, that's what it does.

-- 
    
    Eduardo Krell                   AT&T Bell Laboratories, Murray Hill

    {ihnp4,seismo,ucbvax}!ulysses!ekrell

whp@cbnap.UUCP (01/19/87)

Typing "typeset -f" does indeed list all functions and their definitions.
To list only the definition for function foo, type "typeset -f foo".
Works similar to alias (ie "alias" lists all aliases, while "alias foo"
lists only the alias definition for foo).

Wayne H. Pollock,
The Shell Answer Man
UUCP:	...{ihnp4,cbatt}!cbnap!whp
DELPHI:	WHP
GEnie:	W.POLLOCK

	"The opinions expressed above are ficticious.  Any resemblance
	to the opinions of persons living or dead is purely coincidental."

grs@houxa.UUCP (G.SILLS) (01/20/87)

In article <221@cbnap.UUCP>, whp@cbnap.UUCP (Wayne H. Pollock) writes:
> Typing "typeset -f" does indeed list all functions and their definitions.
> To list only the definition for function foo, type "typeset -f foo".
> Works similar to alias (ie "alias" lists all aliases, while "alias foo"
> lists only the alias definition for foo).
> 
	just type "functions<cr>"

At least, that's what works with our version of ksh.

	Glenn Sills ihnp4!houxa!grs