Why source command doesn't work with process substitution in bash 3.2?

后端 未结 1 1663
囚心锁ツ
囚心锁ツ 2020-11-27 22:04

I\'ve the following shell script:

cat <(echo foo)
source <(echo bar=bar)
echo $bar

However it works differently in GNU bash 3.2 and 4

1条回答
  •  忘掉有多难
    2020-11-27 22:18

    This is a known limitation in bash 3.2. To work around it:

    source /dev/stdin <<<"$(echo bar=bar)"
    

    ...or, similarly:

    source /dev/stdin <<<"$(cat <(...))"
    

    0 讨论(0)
提交回复
热议问题