Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can define and print the contents of variable called my_var like this:

echo $my_var

but if I define:

my_funct {echo "hello";}

how can I recall my function's definition later on?

share|improve this question
up vote 5 down vote accepted

With the type command:

dennis@lightning:~$ foo() { echo "hi"; }
dennis@lightning:~$ type foo
foo is a function
foo () 
    echo "hi"
share|improve this answer
Great!, thanks! – Robert Vila Nov 16 '12 at 19:05

To get just the definition without "foo is a function",

$ declare -f foo
foo () 
    echo "hi"
share|improve this answer

Your Answer


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.