Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

So I am editing bashrc constantly, and I have a terminal open with a working function definition, although bashrc has been updated with a wrong function definition. (Because the definition do not change until I source the updated bashrc) How can I look up the working function definition in this case? For example, if I type:

alias function_name

I can see what the definition is for that alias. Is there a command similar for function? If not, is there a command to output entire bashrc that the current terminal is using?

share|improve this question

1 Answer 1

up vote 5 down vote accepted
typeset -f function

displays the indicated function's current definition. It works in ksh (where it originated), bash and zsh. (n.b. in zsh, type -f, which, functions and whence -f also show the function definition.)

share|improve this answer
    
You can also use whence -cv in zsh. The -v option is to tell you, if there is no such alias or function (or otherwise executable in you PATH) at all. If you use it a lot (as I), you could alias it to a one-word command. –  Emanuel Berg Nov 18 '12 at 20:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.