bug-bash
[Top][All Lists]
Advanced

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

Re: Sourcing a script from a pipe is not reliable


From: Greg Wooledge
Subject: Re: Sourcing a script from a pipe is not reliable
Date: Thu, 10 Jan 2019 08:43:12 -0500
User-agent: NeoMutt/20170113 (1.7.2)

On Thu, Jan 10, 2019 at 12:01:10AM -0800, don fong wrote:
> but on my mac, adding the sleep makes it fail reliably on the first
> iteration.
> 
> on my linux machine, it seems to succeed reliably even with the sleep - as
> expected.

That's because the version of bash on Mac OS X is 3.2.  Bash 3.2 does
not support sourcing from a process substitution.

wooledg:~$ bash-3.2 -c 'source <(echo echo hi)'
wooledg:~$ bash-4.0 -c 'source <(echo echo hi)'
hi

Like Eduardo, I believe there is not going to be a fix for this on your
vendor's version of bash, due to its age.  You could install a newer
version in /usr/local/bin (or another directory of your choice) and use
that instead.  Otherwise, you'll just have to code around the bugs and
missing features of your vendor's bash.



reply via email to

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