啥都别說,上代碼先
#!/bin/bash
dir=${PWD}
icepath=/opt/ICE/bin
oraclehome=/opt/instantclient_11_2
icehome=/opt/ICE
pypath=/opt/IcePy-3.2.1/python
boostpath=/usr/local/boost_143
boostlib=$boostpath/lib
icelib=$icehome/lib
bfinder=`echo $PATH|grep $dir`
echo $bfinder
if [ "$bfinder" == "" ]
then
echo "export PATH=/$PATH:${dir}" >> ~/.bash_profile
export PATH=$PATH:${dir}
fi
bfinder=`echo $PATH|grep $icepath`
echo "export PATH=/$PATH:${icepath}" >> ~/.bash_profile
export PATH=$PATH:${icepath}
else
echo "ice path have been include"
bfinder=`echo $ORACLE_HOME|grep $oraclehome`
echo "export ORACLE_HOME=${oraclehome}">>~/.bash_profile
export ORACLE_HOME=${oraclehome}
bfinder=`echo $ICE_HOME|grep $icehome`
echo "export ICE_HOME=${icehome}">>~/.bash_profile
export ICE_HOME=${icehome}
bfinder=`echo $PYTHONPATH|grep $pypath`
echo "export PYTHONPATH=${pypath}">>~/.bash_profile
export PYTHONPATH=${python}
重要知識點 export隻對目前shell有效,
是以結束之後需要source ~/.bash_profile