bug-bash
[Top][All Lists]
Advanced

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

Re: declare(1) not executing inside source'd script


From: Frank
Subject: Re: declare(1) not executing inside source'd script
Date: Fri, 27 Jul 2018 11:28:55 -0400

Hm.  Strange.  I will examine the environment for weirdness regarding BASH_ENV 
or anything else that might be an issue.  Given that it happens for me in both 
the stock bash 4.2.46 and the locally built 4.4 (on CentOS 7.4), there must be 
something common to both and thus external to the shell itself.

I have installed bashdb on this system as well, but I don’t expect that to have 
affected anything since it’s an add on that Bash shouldn’t have noticed without 
the use of --debugger.

Thanks for your help.

PS:  So the official line is to not specify the man section for builtins to the 
shell?  I will not use section numbers in the future. :)
--
Frank Edwards
Edwards & Edwards Consulting, LLC
Hours:  10A-6P ET
Phone:  (813) 406-0604

Sent from my iPhone.  No electrons were harmed in the creation or transmission 
of this message.

> On Jul 27, 2018, at 10:17 AM, Greg Wooledge <wooledg@eeg.ccf.org> wrote:
> 
>> On Fri, Jul 27, 2018 at 12:26:06AM -0400, frank@eec.com wrote:
>> Repeat-By:
>>    $ cat <<__EOF__ >/tmp/bashbug.bash
>>    > function myfunc {
>>    >     echo "Running..."
>>    > }
>>    > declare -fx myfunc
>>    > declare -p -F | grep "myfunc"
>>    > __EOF__
>>    $ source /tmp/bashbug.bash
>> 
>>    The function is now defined, but is not exported.
>>    And the output of the last command never appears,
>>    but if the same command is executed now -- at
>>    the interactive shell prompt -- it does show that
>>    'myfunc' is defined.
> 
> I cannot reproduce this, either in Debian's bash 4.4, or in bash 5.0-alpha.
> 
> wooledg:~$ exec bash-5.0-alpha
> wooledg:~$ cat foo
> function myfunc {
>  echo "Running"
> }
> declare -fx myfunc
> declare -p -F | grep myfunc
> wooledg:~$ source ./foo
> declare -fx myfunc
> wooledg:~$ bash -c myfunc
> Running
> 
> On my system, I see the output from "declare -p -F" upon sourcing the
> file, and the function is definitely exported.  I get the same results
> using Debian's bash 4.4(.12) as well.




reply via email to

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