is there any way to read the .bash_profile using python? I need to get value of one of variables, like:
export JAVA_HOME=/usr/java
If you are looking for the value of a particular environment variable, there is no need to parse .bash_profile. Just check in os.environ
.
import os
os.environ['JAVA_HOME']
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.