1
分配如預期的那樣多字符串FOO
作品:提供一個環境變量到Python子進程和另一個不
$ read -d '' FOO <<"EOF"
> the content
> EOF
$ echo $FOO
the content
$ python -c "import os; print os.environ.get('FOO')"
the content
看似與FOO_BAR_BAZ
原理不同同樣的事情:
$ read -d '' FOO_BAR_BAZ <<"EOF"
> the content
> EOF
$ echo $FOO_BAR_BAZ
the content
$ python -c "import os; print os.environ.get('FOO_BAR_BAZ')"
None
我要麼一個微妙的錯誤或誤解。
太好了,謝謝!將接受一些。所以,我可以使用'read -d''FOO_BAR_BAZ'來完成賦值,然後在那之後'輸出FOO_BAR_BAZ'。 –