Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Greg Wooledge Newsgroups: gnu.bash.bug Subject: Re: declare(1) not executing inside source'd script Date: Fri, 27 Jul 2018 10:17:01 -0400 Lines: 35 Approved: bug-bash@gnu.org Message-ID: References: <20180727042606.EFCD8120EA6@student.eeconsulting.net> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: usenet.stanford.edu 1532701029 4816 208.118.235.17 (27 Jul 2018 14:17:09 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: frank@eec.com Envelope-to: bug-bash@gnu.org Mail-Followup-To: frank@eec.com, bug-bash@gnu.org Content-Disposition: inline In-Reply-To: <20180727042606.EFCD8120EA6@student.eeconsulting.net> User-Agent: NeoMutt/20170113 (1.7.2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 139.137.100.1 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:14407 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.