1

Consider this code I run directly in bash (Mac):

> source <(echo "ABC=1")
> echo $ABC
1

Now, if I put these two lines in a test.sh script and execute:

#!/bin/bash
source <(echo "ABC=1")
echo $ABC

nothing is echo'ed, so it looks like source doesn't work? Any ideas?

Btw, I tried replacing source with . - the same problem.

2
  • Works when I run it. The output is 1. Commented Jul 19, 2022 at 3:18
  • 2
    You will find an answer here. Commented Jul 19, 2022 at 4:06

1 Answer 1

2

Apple's bash just appears to be too old. I reproduced your failure locally, but it works fine with bash 5.1.16 from homebrew.

I didn't look up any specific bug fixes or version notes, though, sorry.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.