bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: declare -p my_function does not print its definition. A bug?


From: Chet Ramey
Subject: Re: declare -p my_function does not print its definition. A bug?
Date: Sat, 18 Oct 2014 18:20:09 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 10/18/14 10:35 AM, Tim Friske wrote:
> Hi,
> 
> when I define the following function:
> 
>   $ function foo {
>   >  echo bar
>   > }
> 
> and try to run it, I get:
> 
>   $ foo
>   bar
> 
> but try to print its definition with "declare", I get:
> 
>   $ declare -p foo
>   bash: declare: foo: not found
>   $ declare -pf foo
>   bash: declare: foo: not found
>   $declare -pF foo
>   bash: declare: foo: not found
> 
> but try to print its definition with "type", I get:
> 
>   $ type foo
>   foo is a function
>   foo ()
>   {
>       echo bar
>   }
> 
> I'm running the above commands in the following environment:
> 
>   * Fedora Linux 20 "Heisenbug"
>   * BASH_VERSION => 4.2.53(1)-release
>   * bash --version => GNU bash, version 4.2.53(1)-release
> (x86_64-redhat-linux-gnu)

This changed between bash-4.2 and bash-4.3.  Bash-4.3 behaves as you
expect.  (According to CHANGES, it changed between bash-4.3-alpha and
bash-4.3-beta.)

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]