linux shell 将当前文件地址作为默认路径写入环境变量

来源:互联网 发布:小刀源码 编辑:程序博客网 时间:2024/06/15 22:20

写了一段小代码,记录如下

#!/bin/bash
dir=${PWD}
bfinder=`echo $PATH|grep $dir`
echo $bfinder
if [ "$bfinder" == "" ]
then
        echo "export PATH=/$PATH:${dir}" >> ~/.bash_profile
        export PATH=$PATH:${dir}
fi