0

I am trying to source the output of a process substitution, and I'm not getting what I expect:

$ foo=bar
$ . <(echo 'foo=BAR')
$ echo $foo
bar

I would have expected BAR to be the output. Can someone tell me what I'm missing?

I am on a Mac running High Sierra (MacOs 10.13.6). I am using GNU bash, version 4.4.23(1)-release (x86_64-apple-darwin17.5.0).

weary.pilgrim
  • 113
  • 1
  • 7
  • I am able to achieve my goal by doing `. /dev/stdin <<< $(echo 'foo=BAR')`, but process substitution seems cleaner, and I'd like to know why this doesn't work. – weary.pilgrim Sep 14 '18 at 14:26
  • Cannot reproduce `bash` 4.4.19 or (forthcoming) 5.0. (macOS 10.12.6, but I don't think that's relevant.) Are you sure you didn't accidentally test this in the 3.2 version that ships with macOS (where `.` does have problems with a process substitution as input, the details of which escape me)?. – chepner Sep 14 '18 at 14:26
  • The duplicate contains [a link to the relevant comment from the maintainer](http://lists.gnu.org/archive/html/bug-bash/2006-01/msg00018.html). – chepner Sep 14 '18 at 14:32

0 Answers0