【发布时间】:2013-06-30 09:06:33
【问题描述】:
我正在运行一个 bash 脚本 (test.sh),它会加载到环境变量中(来自 env.sh)。这很好,但我试图看到 python 可以加载已经在 bash 脚本中的变量。
是的,我知道只传递我需要的特定变量作为参数可能会更容易,但我很好奇是否可以获取 bash 变量。
test.sh
#!/bin/bash
source env.sh
echo $test1
python pythontest.py
env.sh
#!/bin/bash
test1="hello"
pythontest.py
?
print test1 (that is what I want)
【问题讨论】:
标签: python bash scripting environment-variables