在做Linux开发的过程中,经常要添加一些环境变量,最典型的就是PATH。根据《.bashrc和/etc/profile》可知,根据作用域的不同可以在.bashrc或者/etc/profile中添加相应的环境变量。下面是我在Ubuntu14.04的~/.bashrc中添加的环境变量:
export PATH=$PATH:/home/liyihai/embeddedSystem/qtcreator-2.6.1/bin
export PATH=$PATH:/home/liyihai/embeddedSystem/qtarm-2009q1/bin
export PATH=$PATH:/home/liyihai/embeddedSystem/arago-2011.09/armv5te/bin
export PATH=$PATH:/home/liyihai/embeddedSystem/qt_libs/qt-arm-4.8.3/bin
export QMAKESPEC=$QMAKESPEC:/home/liyihai/embeddedSystem/qt_libs/qt-arm-4.8.3/mkspecs/qws/linux-omapl138-g++
为了使其立即生效,执行下面命令:
source .bashrc
参考资料