Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14407 > unrolled thread

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

Started byGreg Wooledge <wooledg@eeg.ccf.org>
First post2018-07-27 10:17 -0400
Last post2018-07-27 10:17 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: declare(1) not executing inside source'd script Greg Wooledge <wooledg@eeg.ccf.org> - 2018-07-27 10:17 -0400

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

FromGreg Wooledge <wooledg@eeg.ccf.org>
Date2018-07-27 10:17 -0400
SubjectRe: declare(1) not executing inside source'd script
Message-ID<mailman.4330.1532701029.1292.bug-bash@gnu.org>
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.

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web